@hsupu/copilot-api 0.7.20 → 0.7.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,12 +5,9 @@
5
5
  # ============================================================================
6
6
  # Proxy
7
7
  # ============================================================================
8
- # Proxy URL for all outgoing requests to GitHub / Copilot APIs.
9
- # Supports http://, https://, socks5://, socks5h:// schemes.
10
- # socks5h:// routes DNS through the proxy (recommended for privacy).
11
- # Authentication via URL credentials: socks5h://user:pass@host:port
12
- # Takes precedence over HTTP_PROXY/HTTPS_PROXY environment variables.
13
- # CLI --proxy flag takes precedence over this setting.
8
+ # Proxy URL for all outgoing requests to GitHub / Copilot APIs. Supports http://, https://, socks5://, socks5h://.
9
+ # socks5h:// routes DNS through the proxy (recommended for privacy). Auth via URL: socks5h://user:pass@host:port
10
+ # Takes precedence over HTTP_PROXY/HTTPS_PROXY env vars. CLI --proxy flag takes precedence over this setting.
14
11
  # NOT hot-reloadable (requires restart).
15
12
 
16
13
  # proxy: "http://127.0.0.1:7890"
@@ -27,41 +24,44 @@
27
24
  # - Short aliases: "opus", "sonnet", "haiku" (resolved to best available)
28
25
  #
29
26
  # Matching order: raw request name checked first, then resolved (normalized) name.
30
- # User overrides are deep-merged with built-in defaults (same key = user wins).
31
27
  #
32
28
  # Built-in defaults (always active unless overridden):
33
29
  # opus → claude-opus-4.6
34
30
  # sonnet → claude-sonnet-4.6
35
31
  # haiku → claude-haiku-4.5
36
32
  #
37
- # If the target model is not in the available models list, it is treated as an
38
- # alias and resolved again. If still unavailable, the best model in the same
39
- # family is used as fallback.
33
+ # If the target model is not in the available models list, it is treated as an alias and resolved again.
34
+ # If still unavailable, the best model in the same family is used as fallback.
40
35
 
41
36
  model_overrides:
42
37
  opus: claude-opus-4.6-1m
43
- sonnet: claude-opus-4.6-1m # Redirect all sonnet requests to best opus
38
+ # Redirect all sonnet requests to best opus
39
+ # sonnet: claude-opus-4.6-1m
44
40
  haiku: claude-sonnet-4.6
45
41
  claude-opus-4.5: claude-opus-4.6-1m
46
42
  claude-opus-4.6: claude-opus-4.6-1m
47
43
  claude-opus-4-6: claude-opus-4.6-1m
48
- claude-sonnet-4.5: claude-sonnet-4.6 # Latest sonnet
49
- claude-haiku-4.5: claude-sonnet-4.5 # Upgrade haiku to sonnet
44
+ # Use latest sonnet
45
+ claude-sonnet-4.5: claude-sonnet-4.6
46
+ # Upgrade haiku to sonnet
47
+ claude-haiku-4.5: claude-sonnet-4.6
50
48
 
51
49
  # ============================================================================
52
50
  # Timeouts
53
51
  # ============================================================================
54
52
  # Timeout settings for upstream API connections. Apply to all streaming paths.
55
53
 
56
- stream_idle_timeout: 300 # Max seconds between SSE events (0 = no timeout).
57
- # Applies to all streaming paths (Anthropic, Chat Completions, Responses).
54
+ # Max seconds between SSE events (0 = no timeout).
55
+ # Applies to all streaming paths (Anthropic, Chat Completions, Responses).
56
+ stream_idle_timeout: 300
58
57
 
59
- fetch_timeout: 300 # Seconds: request start HTTP response headers (0 = no timeout).
60
- # Applies to all upstream API clients.
58
+ # Max seconds from request start to HTTP response headers (0 = no timeout).
59
+ # Applies to all upstream API clients.
60
+ fetch_timeout: 600
61
61
 
62
- stale_request_max_age: 600 # Max seconds an active request can live before the stale reaper
63
- # forces it to fail (0 = disabled).
64
- # Safety net for requests that never complete/fail normally.
62
+ # Max seconds an active request can live before the stale reaper forces it to fail (0 = disabled).
63
+ # Safety net for requests that never complete/fail normally.
64
+ stale_request_max_age: 600
65
65
 
66
66
  # ============================================================================
67
67
  # Shutdown
@@ -69,8 +69,10 @@ stale_request_max_age: 600 # Max seconds an active request can live before t
69
69
  # Control graceful shutdown timing.
70
70
 
71
71
  shutdown:
72
- graceful_wait: 60 # Phase 2: seconds to wait for in-flight requests to complete naturally (default: 60)
73
- abort_wait: 120 # Phase 3: seconds to wait after abort signal for handlers to wrap up (default: 120)
72
+ # Phase 2: seconds to wait for in-flight requests to complete naturally (default: 60)
73
+ graceful_wait: 300
74
+ # Phase 3: seconds to wait after abort signal for handlers to wrap up (default: 120)
75
+ abort_wait: 600
74
76
 
75
77
  # ============================================================================
76
78
  # History
@@ -78,8 +80,10 @@ shutdown:
78
80
  # Control history recording behavior.
79
81
 
80
82
  history:
81
- limit: 200 # Maximum number of entries to keep in memory (0 = unlimited, default: 200)
82
- min_entries: 50 # Minimum entries to keep even under memory pressure (default: 50)
83
+ # Maximum number of entries to keep in memory (0 = unlimited, default: 200)
84
+ limit: 200
85
+ # Minimum entries to keep even under memory pressure (default: 50)
86
+ min_entries: 50
83
87
 
84
88
  # ============================================================================
85
89
  # Anthropic
@@ -87,39 +91,68 @@ history:
87
91
  # Settings for Anthropic API tool handling and timeouts.
88
92
 
89
93
  anthropic:
90
- strip_server_tools: false # Strip server-side tools (web_search, etc.) from requests
91
- dedup_tool_calls: false # false | "input" | "result" (true = "input" for compat)
92
- # "input": dedup by (name, input); "result": also require identical result
93
- strip_read_tool_result_tags: false # Strip <system-reminder> tags from Read tool results
94
- # rewrite_system_reminders: false # false = keep all (default), true = remove all
95
- rewrite_system_reminders: # Or provide rewrite rules (first match wins, top-down).
96
- # Note: `model` field is NOT supported here (only in system_prompt_overrides).
94
+ # Strip server-side tools (web_search, etc.) from requests
95
+ strip_server_tools: false
96
+
97
+ # Dedup tool calls: false | "input" | "result" (true = "input" for compat)
98
+ # "input": dedup by (name, input); "result": also require identical result
99
+ dedup_tool_calls: false
100
+
101
+ # Strip <system-reminder> tags from Read tool results
102
+ strip_read_tool_result_tags: false
103
+
104
+ # Server-side context editing mode. Controls how Anthropic's context_management trims older context when input grows large.
105
+ # off: disabled (default). No context_management sent.
106
+ # clear-thinking: clear old thinking blocks.
107
+ # clear-tooluse: clear old tool_use/result pairs.
108
+ # clear-both: apply both clear-thinking and clear-tooluse.
109
+ # Only effective for models that support context editing.
110
+ context_editing: off
111
+
112
+ # Rewrite system-reminder tags in messages. false = keep all (default), true = remove all.
113
+ # Or provide rewrite rules (first match wins, top-down).
114
+ # Note: `model` field is NOT supported here (only in system_prompt_overrides).
115
+ # rewrite_system_reminders: false
116
+ rewrite_system_reminders:
97
117
  - from: "^Whenever you read a file, you should consider whether it would be considered malware"
98
- to: "" # Empty = remove the tag
99
- # - from: ".*" # Catch-all: keep unchanged (gms flags are automatic)
100
- # to: "$0" # $0 = original content
118
+ # Empty = remove the tag
119
+ to: ""
120
+ # - from: ".*" # Catch-all: keep unchanged (gms flags are automatic)
121
+ # to: "$0" # $0 = original content
122
+
123
+ # ============================================================================
124
+ # Responses API
125
+ # ============================================================================
126
+ # Settings for OpenAI Responses API (/v1/responses) endpoint.
127
+
128
+ openai-responses:
129
+ # Convert `call_xxx` IDs to `fc_xxx` in input. Required when clients send conversation history with
130
+ # Chat Completions-format tool call IDs to the Responses API (which requires `fc_` prefix). Default: false.
131
+ normalize_call_ids: true
101
132
 
102
133
  # ============================================================================
103
134
  # Rate Limiter
104
135
  # ============================================================================
105
- # Fine-tune the adaptive rate limiter behavior.
106
- # The rate limiter is enabled/disabled via --no-rate-limit CLI flag;
136
+ # Fine-tune the adaptive rate limiter behavior. The rate limiter is enabled/disabled via --no-rate-limit CLI flag;
107
137
  # these settings control its parameters when enabled.
108
138
 
109
139
  rate_limiter:
110
- retry_interval: 10 # Seconds to wait before retrying after rate limit error
111
- request_interval: 10 # Seconds between requests in rate-limited mode
112
- recovery_timeout: 10 # Minutes before attempting recovery from rate-limited mode
113
- consecutive_successes: 5 # Consecutive successes needed to exit rate-limited mode
140
+ # Seconds to wait before retrying after rate limit error
141
+ retry_interval: 10
142
+ # Seconds between requests in rate-limited mode
143
+ request_interval: 10
144
+ # Minutes before attempting recovery from rate-limited mode
145
+ recovery_timeout: 10
146
+ # Consecutive successes needed to exit rate-limited mode
147
+ consecutive_successes: 5
114
148
 
115
149
  # ============================================================================
116
150
  # Auto-Truncate
117
151
  # ============================================================================
118
152
  # Control auto-truncation behavior when context limits are hit.
119
153
 
120
- # Compress old tool_result content before truncating messages.
121
- # When enabled, large tool_result content blocks are compressed to reduce
122
- # context size before resorting to message removal. Default: true.
154
+ # Compress old tool_result content before truncating messages. When enabled, large tool_result content blocks
155
+ # are compressed to reduce context size before resorting to message removal. Default: true.
123
156
  # compress_tool_results_before_truncate: false
124
157
 
125
158
  # ============================================================================
@@ -130,8 +163,8 @@ rate_limiter:
130
163
  # 2. prepend — text inserted before the system prompt
131
164
  # 3. append — text inserted after the system prompt
132
165
  #
133
- # All three work across all endpoints (Anthropic Messages, Chat Completions,
134
- # Responses API). For OpenAI formats, they target system/developer messages.
166
+ # All three work across all endpoints (Anthropic Messages, Chat Completions, Responses API).
167
+ # For OpenAI formats, they target system/developer messages.
135
168
 
136
169
  # ── Prepend ──
137
170
  # For Anthropic: inserted as the first text block or prepended to the string.
@@ -195,16 +228,13 @@ rate_limiter:
195
228
  # from: the pattern to match
196
229
  # to: the replacement text
197
230
  # method: "line" or "regex" (default: "regex")
198
- # model: regex pattern to filter by resolved model name (optional, case-insensitive)
199
- # When set, the rule only applies to requests whose resolved model matches.
200
- # When omitted, the rule applies to all models.
231
+ # model: regex pattern to filter by resolved model name (optional, case-insensitive).
232
+ # When set, the rule only applies to requests whose resolved model matches. When omitted, applies to all.
201
233
  #
202
234
  # Methods:
203
- # line — splits text by newlines; replaces any line whose trimmed content
204
- # exactly matches trimmed `from`
235
+ # line — splits text by newlines; replaces any line whose trimmed content exactly matches trimmed `from`
205
236
  # regex — applies regex on the full text block with gms flags (default if omitted)
206
- # (g=global, m=multiline ^$ match line boundaries, s=dotAll . matches \n)
207
- # Supports capture group placeholders: $1, $2, etc.
237
+ # (g=global, m=multiline ^$ match line boundaries, s=dotAll . matches \n). Supports $1, $2, etc.
208
238
 
209
239
  # Example: Security Research Mode overrides (removes refusal patterns)
210
240
  # system_prompt_overrides: