feat: adaptive reasoning detection for Codex Chat providers

Auto-detect each Chat-routed Codex provider's reasoning interface from
its name, base URL, and model, then inject the matching thinking
parameter without manual configuration:

- Platform-first inference (OpenRouter, SiliconFlow) overrides model
  rules, since the same model exposes different reasoning controls
  depending on the hosting platform.
- Effort tiers are forwarded only to providers that support them
  (DeepSeek, OpenRouter, and StepFun's step-3.5-flash-2603); on/off-only
  providers (Kimi, GLM, Qwen, MiniMax, MiMo, SiliconFlow) drop the level
  instead of sending a field the upstream rejects.
- OpenRouter 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.
- StepFun falls back to inference so per-model effort support is honored
  (the static preset would have forced effort on step-3.5-flash too).

Includes the Codex provider-form reasoning controls, i18n strings
(zh/en/ja), and response-side reasoning extraction.
This commit is contained in:
Jason
2026-05-21 22:29:18 +08:00
parent 5048ed632d
commit 44d9aabbf3
13 changed files with 1058 additions and 16 deletions
+92 -1
View File
@@ -2,7 +2,11 @@
* Codex 预设供应商配置模板
*/
import { ProviderCategory } from "../types";
import type { CodexApiFormat, CodexCatalogModel } from "../types";
import type {
CodexApiFormat,
CodexCatalogModel,
CodexChatReasoning,
} from "../types";
import type { PresetTheme } from "./claudeProviderPresets";
export interface CodexProviderPreset {
@@ -29,6 +33,8 @@ export interface CodexProviderPreset {
apiFormat?: CodexApiFormat;
// Codex Chat 本地路由模式下的模型目录
modelCatalog?: CodexCatalogModel[];
// Codex Responses -> Chat Completions reasoning capability defaults
codexChatReasoning?: CodexChatReasoning;
}
/**
@@ -261,6 +267,14 @@ requires_openai_auth = true`,
contextWindow: 1000000,
},
]),
codexChatReasoning: {
supportsThinking: true,
supportsEffort: true,
thinkingParam: "thinking",
effortParam: "reasoning_effort",
effortValueMode: "deepseek",
outputFormat: "reasoning_content",
},
category: "cn_official",
icon: "deepseek",
iconColor: "#1E88E5",
@@ -280,6 +294,13 @@ requires_openai_auth = true`,
modelCatalog: modelCatalog([
{ model: "glm-5", displayName: "GLM-5", contextWindow: 200000 },
]),
codexChatReasoning: {
supportsThinking: true,
supportsEffort: false,
thinkingParam: "thinking",
effortParam: "none",
outputFormat: "reasoning_content",
},
category: "cn_official",
icon: "zhipu",
iconColor: "#0F62FE",
@@ -299,6 +320,13 @@ requires_openai_auth = true`,
modelCatalog: modelCatalog([
{ model: "glm-5", displayName: "GLM-5", contextWindow: 200000 },
]),
codexChatReasoning: {
supportsThinking: true,
supportsEffort: false,
thinkingParam: "thinking",
effortParam: "none",
outputFormat: "reasoning_content",
},
category: "cn_official",
icon: "zhipu",
iconColor: "#0F62FE",
@@ -347,6 +375,13 @@ requires_openai_auth = true`,
},
{ model: "qwen3-max", displayName: "Qwen3 Max", contextWindow: 262144 },
]),
codexChatReasoning: {
supportsThinking: true,
supportsEffort: false,
thinkingParam: "enable_thinking",
effortParam: "none",
outputFormat: "reasoning_content",
},
category: "cn_official",
icon: "bailian",
iconColor: "#624AFF",
@@ -366,6 +401,13 @@ requires_openai_auth = true`,
modelCatalog: modelCatalog([
{ model: "kimi-k2.6", displayName: "Kimi K2.6", contextWindow: 262144 },
]),
codexChatReasoning: {
supportsThinking: true,
supportsEffort: false,
thinkingParam: "thinking",
effortParam: "none",
outputFormat: "reasoning_content",
},
category: "cn_official",
icon: "kimi",
iconColor: "#6366F1",
@@ -445,6 +487,13 @@ requires_openai_auth = true`,
contextWindow: 200000,
},
]),
codexChatReasoning: {
supportsThinking: true,
supportsEffort: false,
thinkingParam: "thinking",
effortParam: "none",
outputFormat: "reasoning_content",
},
category: "aggregator",
icon: "modelscope",
iconColor: "#624AFF",
@@ -491,6 +540,13 @@ requires_openai_auth = true`,
contextWindow: 200000,
},
]),
codexChatReasoning: {
supportsThinking: true,
supportsEffort: false,
thinkingParam: "reasoning_split",
effortParam: "none",
outputFormat: "reasoning_details",
},
category: "cn_official",
isPartner: true,
partnerPromotionKey: "minimax_cn",
@@ -520,6 +576,13 @@ requires_openai_auth = true`,
contextWindow: 200000,
},
]),
codexChatReasoning: {
supportsThinking: true,
supportsEffort: false,
thinkingParam: "reasoning_split",
effortParam: "none",
outputFormat: "reasoning_details",
},
category: "cn_official",
isPartner: true,
partnerPromotionKey: "minimax_en",
@@ -570,6 +633,13 @@ requires_openai_auth = true`,
contextWindow: 1048576,
},
]),
codexChatReasoning: {
supportsThinking: true,
supportsEffort: false,
thinkingParam: "thinking",
effortParam: "none",
outputFormat: "reasoning_content",
},
category: "cn_official",
icon: "xiaomimimo",
iconColor: "#000000",
@@ -593,6 +663,13 @@ requires_openai_auth = true`,
contextWindow: 1048576,
},
]),
codexChatReasoning: {
supportsThinking: true,
supportsEffort: false,
thinkingParam: "thinking",
effortParam: "none",
outputFormat: "reasoning_content",
},
category: "cn_official",
icon: "xiaomimimo",
iconColor: "#000000",
@@ -662,6 +739,13 @@ requires_openai_auth = true`,
modelCatalog: modelCatalog([
{ model: "zai-org/glm-5", displayName: "GLM-5", contextWindow: 202800 },
]),
codexChatReasoning: {
supportsThinking: true,
supportsEffort: false,
thinkingParam: "thinking",
effortParam: "none",
outputFormat: "reasoning_content",
},
category: "aggregator",
icon: "novita",
iconColor: "#000000",
@@ -685,6 +769,13 @@ requires_openai_auth = true`,
contextWindow: 262144,
},
]),
codexChatReasoning: {
supportsThinking: true,
supportsEffort: false,
thinkingParam: "thinking",
effortParam: "none",
outputFormat: "reasoning_content",
},
category: "aggregator",
icon: "nvidia",
iconColor: "#000000",