mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
docs: document Codex Chat reasoning auto-detection
Add a "Reasoning Auto-Detection" subsection to the Codex local-routing manual (zh/en/ja) with the provider capability matrix, and record the feature plus the streaming-usage and tool-call reasoning backfill fixes in the changelog. Drop the removed Kimi For Coding preset from the changelog's Codex Chat preset list.
This commit is contained in:
+4
-1
@@ -10,9 +10,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Added
|
||||
|
||||
- **Codex Chat Completions Routing**: Codex providers can now be served by upstreams that only speak the OpenAI Chat Completions API. CC Switch's local proxy converts Codex's outgoing Responses requests into Chat Completions and rebuilds the Chat response (both JSON and SSE) back into Responses shape, preserving `reasoning_content`, inline `<think>` blocks, streamed reasoning summaries, tool calls, and `previous_response_id` follow-ups. A bounded Codex Chat history cache restores tool calls before their tool outputs.
|
||||
- **23 Codex Third-Party Provider Presets with Chat Routing**: Enabled Chat Completions routing with explicit model catalogs for major Chinese/Asian providers — DeepSeek, Zhipu GLM (+ en), Kimi, Kimi For Coding, MiniMax (+ en), StepFun (+ en), Baidu Qianfan Coding Plan, Bailian, ModelScope, Longcat, BaiLing, Xiaomi MiMo (+ Token Plan), Volcengine Agentplan, BytePlus, DouBao Seed, SiliconFlow (+ en), Novita AI, and Nvidia. Each preset declares its context window so the UI can size the model-mapping rows.
|
||||
- **22 Codex Third-Party Provider Presets with Chat Routing**: Enabled Chat Completions routing with explicit model catalogs for major Chinese/Asian providers — DeepSeek, Zhipu GLM (+ en), Kimi, MiniMax (+ en), StepFun (+ en), Baidu Qianfan Coding Plan, Bailian, ModelScope, Longcat, BaiLing, Xiaomi MiMo (+ Token Plan), Volcengine Agentplan, BytePlus, DouBao Seed, SiliconFlow (+ en), Novita AI, and Nvidia. Each preset declares its context window so the UI can size the model-mapping rows.
|
||||
- **Codex Model Mapping Table**: Codex provider forms now expose a model catalog (model + display name + context window per row) that is the single source of truth for the upstream model list, projected to `~/.codex/cc-switch-model-catalog.json`.
|
||||
- **Codex Chat Providers in Stream Check**: Stream Check now probes Chat-format Codex providers against `/chat/completions` with a Chat-shaped body instead of `/v1/responses`, and aligns its URL fallback order with the production `CodexAdapter` (origin-only base URLs hit `/v1/<endpoint>` first) so a non-404 error on the bare path no longer flags a working provider as down.
|
||||
- **Codex Chat Reasoning Auto-Detection**: When a Codex provider is served through Chat Completions routing, CC Switch now auto-detects the upstream's reasoning interface from its name, base URL, and model — injecting the correct thinking parameter (`thinking:{type}`, `enable_thinking`, `reasoning_split`, top-level `reasoning_effort`, or OpenRouter's native `reasoning:{effort}` object) with no manual setup. Aggregator/hosting platforms (OpenRouter, SiliconFlow) are matched platform-first, since the same model can expose different reasoning controls on different platforms. Providers that only expose a thinking on/off switch (Kimi, GLM, Qwen, MiniMax, MiMo, SiliconFlow) drop the effort *level* instead of forwarding an unsupported field — so changing Codex's reasoning effort has no effect for them — while providers with real effort tiers (DeepSeek, OpenRouter, and StepFun's `step-3.5-flash-2603` only) pass the level through. OpenRouter specifically uses the native `reasoning:{effort}` object, clamps `max` to `xhigh` (its enum has no `max`), and forwards an explicit `effort:"none"` so reasoning can be turned off.
|
||||
- **Xiaomi MiMo Token Plan Presets**: Added Xiaomi MiMo Token Plan presets with specs aligned to the official documentation (#2803).
|
||||
- **Claude Desktop Official Preset**: Added a Claude Desktop Official preset that restores the native Claude Desktop login, plus a localized Claude Desktop user guide (en / zh / ja).
|
||||
|
||||
@@ -31,6 +32,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- **Codex Model Catalog Infinite Render Loop**: Broke a bidirectional sync cycle between the catalog table and its parent state that caused severe UI jittering when adding or editing entries.
|
||||
- **Codex Chat Preserves User-Selected Catalog Model**: A model the client selects from the catalog (e.g. via `/model`) is no longer overwritten by `config.toml`'s default model.
|
||||
- **Codex Chat Reasoning and Cache Stability**: Restored a unique call-id fallback when Codex omits or rewrites `previous_response_id`, stopped deriving cache identity from `previous_response_id`, and canonicalized parseable JSON string payloads in tool conversions for stable prefix-cache reuse.
|
||||
- **Codex Chat Streaming Usage Recovered**: The Responses-to-Chat conversion now injects `stream_options.include_usage` (merging into any client-provided `stream_options`) when a request is streaming, so OpenAI-compatible upstreams like Kimi and MiniMax emit the trailing usage chunk again. Previously their streamed token / cost / cache stats were recorded as zero on the Codex Chat path.
|
||||
- **Codex Chat Tool-Call Reasoning Backfill**: Thinking models like Kimi/Moonshot and DeepSeek reject an assistant message that carries `tool_calls` without a non-empty `reasoning_content`. When cross-turn history recovery misses (proxy restart, ambiguous `call_id`, or a turn with no upstream reasoning), a placeholder `reasoning_content` is now backfilled in a final pass — genuine trailing reasoning still attaches first — so the request no longer fails with `reasoning_content is missing in assistant tool call message`.
|
||||
- **Managed-Account Claude Takeover Auth**: Managed-account providers (GitHub Copilot / Codex OAuth) now drop token env keys and write only the `ANTHROPIC_API_KEY` placeholder when taking over Claude Live config, with an outbound guard that refuses to send the `PROXY_MANAGED` placeholder upstream.
|
||||
- **Gemini Native Tool-Call Robustness**: Fixed `functionResponse.name` resolution (422) and `thought_signature` replay (400) for synthesized tool-call IDs in long multi-turn sessions (#2814).
|
||||
- **Session Log Subagent Token Accounting**: `collect_jsonl_files()` now scans subagent JSONL logs that were previously missed, so subagent token usage is counted in session cost (session-log mode only) (#2821).
|
||||
|
||||
@@ -581,6 +581,24 @@ Once **Needs Local Routing** is enabled, a **Model Mapping** table appears below
|
||||
- Entries are saved exactly as listed and are the single source of truth for the model list
|
||||
- **Codex must be restarted** to refresh the model list after changes (`model_catalog_json` is loaded at Codex startup)
|
||||
|
||||
#### Reasoning Auto-Detection
|
||||
|
||||
With Local Routing on, CC Switch **auto-detects** each provider's reasoning interface and converts Codex's outgoing reasoning request into a parameter the upstream understands — **no manual setup required**. Detection is based on the provider's name, base URL, and model:
|
||||
|
||||
- **Aggregator / hosting platforms first**: OpenRouter, SiliconFlow, etc. are handled by platform rules (the same model can expose a completely different reasoning interface on different platforms)
|
||||
- **Otherwise by model brand**: DeepSeek, Kimi / Moonshot, Zhipu GLM, Qwen, MiniMax, Xiaomi MiMo, StepFun each have their own rules
|
||||
|
||||
Providers fall into two reasoning-capability tiers:
|
||||
|
||||
| Capability | Meaning | Example providers |
|
||||
|------------|---------|-------------------|
|
||||
| **Effort levels supported** | Reasoning strength is adjustable (low / medium / high, etc.) | DeepSeek, OpenRouter, StepFun (`step-3.5-flash-2603` only) |
|
||||
| **On/off switch only** | Reasoning can only be turned on or off; **levels have no effect** | Kimi, Zhipu GLM, Qwen, MiniMax, Xiaomi MiMo, SiliconFlow |
|
||||
|
||||
> ⚠️ **Effort levels do nothing for some providers**: if a provider only supports an on/off switch, changing the reasoning effort in Codex (`model_reasoning_effort` low / medium / high) has **no effect** — CC Switch does not forward the level to these upstreams (their API rejects the parameter, and sending it anyway may break the request). Their reasoning is **on by default** and works via on/off rather than tiering. Only providers with real effort levels (e.g. DeepSeek, OpenRouter) actually respond to a level change.
|
||||
|
||||
> 💡 **Detection is keyword matching on name / base URL / model**, not a real capability probe. Official domains (e.g. `api.deepseek.com`, `api.moonshot.cn`) are always recognized; a relay that rewrites the domain and model name may not be detected, in which case no reasoning parameter is injected.
|
||||
|
||||
### Codex 1M Context Window
|
||||
|
||||
When adding a Codex provider, an **Enable 1M Context Window** toggle is available:
|
||||
|
||||
@@ -581,6 +581,24 @@ Codex プロバイダーの編集時、**ローカルルーティングが必要
|
||||
- リストの内容はそのまま保存され、モデルリストの唯一の情報源となります
|
||||
- 変更後、モデルリストを更新するには **Codex の再起動が必要** です(`model_catalog_json` は Codex 起動時に読み込まれます)
|
||||
|
||||
#### 思考能力(Reasoning)の自動判定
|
||||
|
||||
ローカルルーティングを有効にすると、CC Switch はプロバイダーの「思考」(reasoning)インターフェースを**自動判定**し、Codex が送る思考リクエストを上流が理解できるパラメータに変換します(**手動設定は不要**)。判定はプロバイダーの名前・エンドポイント・モデル名に基づきます:
|
||||
|
||||
- **集約 / ホスティングプラットフォーム優先**:OpenRouter、SiliconFlow などはプラットフォーム規則で処理(同じモデルでもプラットフォームごとに思考インターフェースが全く異なる場合があるため)
|
||||
- **それ以外はモデルブランド別**:DeepSeek、Kimi / Moonshot、Zhipu GLM、Qwen、MiniMax、Xiaomi MiMo、StepFun などにそれぞれ規則あり
|
||||
|
||||
プロバイダーの「思考」能力は 2 種類に分かれます:
|
||||
|
||||
| 能力 | 意味 | 代表的なプロバイダー |
|
||||
|------|------|----------------------|
|
||||
| **思考レベル対応** | 思考の強度を調整可能(low / medium / high など) | DeepSeek、OpenRouter、StepFun(`step-3.5-flash-2603` のみ) |
|
||||
| **オン / オフ切替のみ** | 思考のオン / オフのみ、**レベルは無効** | Kimi、Zhipu GLM、Qwen、MiniMax、Xiaomi MiMo、SiliconFlow |
|
||||
|
||||
> ⚠️ **一部のプロバイダーでは思考レベルが効きません**:オン / オフ切替のみのプロバイダーでは、Codex で思考レベル(`model_reasoning_effort` の low / medium / high)を変えても**効果はありません**——CC Switch はこれらの上流にレベルを送りません(API がパラメータを受け付けず、無理に送るとリクエストが拒否される可能性があるため)。これらのプロバイダーの思考は**デフォルトでオン**で、「調整」ではなく「オン / オフ」で動作します。実際にレベル変更が効くのは、思考レベルに対応したプロバイダー(DeepSeek、OpenRouter など)だけです。
|
||||
|
||||
> 💡 **判定は名前 / エンドポイント / モデル名のキーワードマッチング**であり、実際の能力探索ではありません。公式ドメイン(`api.deepseek.com`、`api.moonshot.cn` など)は常に認識されますが、ドメインとモデル名を書き換えた中継サービスでは判定できないことがあり、その場合は思考パラメータが一切注入されません。
|
||||
|
||||
### Codex 1M コンテキストウィンドウ
|
||||
|
||||
Codex プロバイダーの追加時、**1M コンテキストウィンドウを有効化** トグルが利用できます:
|
||||
|
||||
@@ -581,6 +581,24 @@ v3.13.0 起新增的高级选项。默认情况下,CC Switch 会把配置的 `
|
||||
- 表中条目按填写内容原样保存,是模型列表的唯一来源
|
||||
- **修改后需要重启 Codex** 才能刷新模型列表(`model_catalog_json` 在 Codex 启动时加载)
|
||||
|
||||
#### 思考能力(Reasoning)自适应
|
||||
|
||||
开启本地路由后,CC Switch 会**自动识别**供应商的「思考」(reasoning)接口,把 Codex 发出的思考请求转换成上游能理解的参数,**无需手动配置**。识别依据是供应商的名称、端点和模型名:
|
||||
|
||||
- **聚合 / 托管平台优先**:OpenRouter、SiliconFlow 等按平台规则处理(同一模型在不同平台上的思考接口可能完全不同)
|
||||
- **其余按模型品牌**:DeepSeek、Kimi / Moonshot、智谱 GLM、通义千问、MiniMax、小米 MiMo、阶跃星辰 StepFun 等各有对应规则
|
||||
|
||||
不同供应商支持的「思考」能力分两类:
|
||||
|
||||
| 能力 | 含义 | 代表供应商 |
|
||||
|------|------|-----------|
|
||||
| **支持思考等级** | 可调节思考强度(low / medium / high 等) | DeepSeek、OpenRouter、StepFun(仅 `step-3.5-flash-2603`) |
|
||||
| **仅支持思考开关** | 只能开 / 关思考,**等级无效** | Kimi、智谱 GLM、通义千问、MiniMax、小米 MiMo、SiliconFlow |
|
||||
|
||||
> ⚠️ **思考等级对部分供应商无效**:如果供应商只支持「思考开关」,那么在 Codex 里调节思考等级(`model_reasoning_effort` 的 low / medium / high)**不会有任何效果**——CC Switch 不会把等级透传给这类上游(它们的接口不接受该参数,硬传可能导致请求被拒)。这类供应商的思考默认**开启**,靠「开 / 关」而非「调档」工作。只有支持思考等级的供应商(如 DeepSeek、OpenRouter),调节等级才真正生效。
|
||||
|
||||
> 💡 **识别基于名称 / 端点 / 模型名的关键词匹配**,不是真正的能力探测。官方域名(如 `api.deepseek.com`、`api.moonshot.cn`)都能正确识别;如果你用的中转改写了域名和模型名,可能识别不到,此时不会注入任何思考参数。
|
||||
|
||||
### Codex 1M 上下文窗口
|
||||
|
||||
添加 Codex 供应商时,提供 **启用 1M 上下文窗口** 开关:
|
||||
|
||||
Reference in New Issue
Block a user