在 Codex 中使用千问AI平台模型
Codex 是 OpenAI 推出的终端 AI 编程助手。可通过 Token Plan 个人版、Token Plan 团队版或按量计费接入千问AI平台。
执行以下命令验证安装。
然后配置模型元数据,以便在模型间切换。新建
在
配置完成后,可通过
然后配置模型元数据,以便在模型间切换。新建
在
配置完成后,可通过
然后配置模型元数据,以便在模型间切换。新建
在
配置完成后,可通过
解决方案:建议参照上文配置说明,直接在
安装 Codex
- 安装或更新 Node.js(v18.0 或更高版本)。
- 在终端中执行以下命令安装 Codex。
复制
npm install -g @openai/codex
复制
codex --version
配置接入凭证
接入需要编辑配置文件~/.codex/config.toml 并配置环境变量 OPENAI_API_KEY。请根据所选计费方案选择对应配置。
Token Plan 个人版
model 请选择支持的模型。将 OPENAI_API_KEY 环境变量设置为 Token Plan 个人版专属 API Key。
步骤一:配置环境变量
将OPENAI_API_KEY 环境变量设置为 Token Plan 个人版专属 API Key。
- macOS
- Windows
- 在终端中执行以下命令,查看默认 Shell 类型。
复制
echo $SHELL
- 根据 Shell 类型设置环境变量:
复制
# 将 YOUR_API_KEY 替换为Token Plan 个人版 API Key
echo 'export OPENAI_API_KEY="YOUR_API_KEY"' >> ~/.zshrc
- 执行以下命令使环境变量生效。
复制
source ~/.zshrc
- CMD
- PowerShell
- 在 CMD 中运行以下命令,设置环境变量。
复制
REM 将 YOUR_API_KEY 替换为Token Plan 个人版 API Key
setx OPENAI_API_KEY "YOUR_API_KEY"
- 打开一个新的 CMD 窗口,运行以下命令检查环境变量是否生效。
复制
echo %OPENAI_API_KEY%
- 在 PowerShell 中运行以下命令,设置环境变量。
复制
# 将 YOUR_API_KEY 替换为Token Plan 个人版 API Key
[Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "YOUR_API_KEY", [EnvironmentVariableTarget]::User)
- 打开一个新的 PowerShell 窗口,运行以下命令检查环境变量是否生效。
复制
echo $env:OPENAI_API_KEY
步骤二:选择接入方式
根据模型支持的接入方式,选择以下一种配置:Responses API
若所选模型支持 OpenAI Responses API,可使用最新版 Codex。复制
model_provider = "Model_Studio_Token_Plan_Personal"
model = "auto"
[model_providers.Model_Studio_Token_Plan_Personal]
name = "Model_Studio_Token_Plan_Personal"
base_url = "https://token-plan.maas.qianwenaiapi.com/compatible-mode/v1"
env_key = "OPENAI_API_KEY"
wire_api = "responses"
~/.codex/model-catalog.local.json,写入该套餐支持的模型:
复制
{
"models": [
{
"slug": "auto",
"display_name": "auto",
"description": "DashScope model: auto",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 1,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "qwen3.8-max",
"display_name": "qwen3.8-max",
"description": "DashScope model: qwen3.8-max",
"default_reasoning_level": "xhigh",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 983616,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": true,
"input_modalities": ["text", "image"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 1,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "qwen3.8-flash",
"display_name": "qwen3.8-flash",
"description": "DashScope model: qwen3.8-flash",
"default_reasoning_level": "xhigh",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 983616,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": true,
"input_modalities": ["text", "image"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 2,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "qwen3.7-max",
"display_name": "qwen3.7-max",
"description": "DashScope model: qwen3.7-max",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 3,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "qwen3.7-plus",
"display_name": "qwen3.7-plus",
"description": "DashScope model: qwen3.7-plus",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": true,
"input_modalities": ["text", "image"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 4,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "qwen3.6-flash",
"display_name": "qwen3.6-flash",
"description": "DashScope model: qwen3.6-flash",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": true,
"input_modalities": ["text", "image"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 5,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "glm-5.3",
"display_name": "glm-5.3",
"description": "DashScope model: glm-5.3",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 6,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "glm-5.2",
"display_name": "glm-5.2",
"description": "DashScope model: glm-5.2",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 7,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "deepseek-v4.1-flash",
"display_name": "deepseek-v4.1-flash",
"description": "DashScope model: deepseek-v4.1-flash",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": true,
"input_modalities": ["text", "image"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 8,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "deepseek-v4-pro",
"display_name": "deepseek-v4-pro",
"description": "DashScope model: deepseek-v4-pro",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 163840,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 9,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "deepseek-v4-pro-0813",
"display_name": "deepseek-v4-pro-0813",
"description": "DashScope model: deepseek-v4-pro-0813",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 163840,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 10,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "deepseek-v4-flash-0731",
"display_name": "deepseek-v4-flash-0731",
"description": "DashScope model: deepseek-v4-flash-0731",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 11,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
}
]
}
~/.codex/config.toml 中添加以下配置指向该文件:
复制
model_catalog_json = "~/.codex/model-catalog.local.json"
codex -m 指定模型 ID(例如 codex -m qwen3.8-flash),或在 TUI 中输入 /model 在已配置的模型间切换。
Chat/Completions API(其他模型)
其他模型需通过 Chat/Completions API 接入,需安装旧版本 Codex,如 0.80.0(新版本 Codex 已不再支持 wire_api = "chat" 配置,升级后如遇报错请参见下文 FAQ):复制
npm install -g @openai/codex@0.80.0
复制
model_provider = "Model_Studio_Token_Plan_Personal"
model = "glm-5"
[model_providers.Model_Studio_Token_Plan_Personal]
name = "Model_Studio_Token_Plan_Personal"
base_url = "https://token-plan.maas.qianwenaiapi.com/compatible-mode/v1"
env_key = "OPENAI_API_KEY"
wire_api = "chat"
qwen3.8-max 思考模式说明:
- thinking:支持开启和关闭(混合思考模式)。
- temperature:思考模式下默认值为 0.6;传入值小于 0.6 时自动调整为 0.6。
- reasoning_effort:控制推理深度,可选 xhigh、medium、low,默认 xhigh。
Token Plan 团队版
model 请选择支持的模型。将 OPENAI_API_KEY 环境变量设置为 Token Plan 团队版专属 API Key。
文本模型(如 qwen3.6-plus、glm-5 等)可直接使用。图像生成模型需通过 Skill 接入,参见接入图像生成模型。
步骤一:配置环境变量
将OPENAI_API_KEY 环境变量设置为 Token Plan 团队版专属 API Key。
- macOS
- Windows
- 在终端中执行以下命令,查看默认 Shell 类型。
复制
echo $SHELL
- 根据 Shell 类型设置环境变量:
复制
# 将 YOUR_API_KEY 替换为Token Plan 团队版 API Key
echo 'export OPENAI_API_KEY="YOUR_API_KEY"' >> ~/.zshrc
- 执行以下命令使环境变量生效。
复制
source ~/.zshrc
- CMD
- PowerShell
- 在 CMD 中运行以下命令,设置环境变量。
复制
REM 将 YOUR_API_KEY 替换为Token Plan 团队版 API Key
setx OPENAI_API_KEY "YOUR_API_KEY"
- 打开一个新的 CMD 窗口,运行以下命令检查环境变量是否生效。
复制
echo %OPENAI_API_KEY%
- 在 PowerShell 中运行以下命令,设置环境变量。
复制
# 将 YOUR_API_KEY 替换为Token Plan 团队版 API Key
[Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "YOUR_API_KEY", [EnvironmentVariableTarget]::User)
- 打开一个新的 PowerShell 窗口,运行以下命令检查环境变量是否生效。
复制
echo $env:OPENAI_API_KEY
步骤二:选择接入方式
根据模型支持的接入方式,选择以下一种配置:Responses API
若所选模型支持 OpenAI Responses API,可使用最新版 Codex。复制
model_provider = "Model_Studio_Token_Plan"
model = "auto"
[model_providers.Model_Studio_Token_Plan]
name = "Model_Studio_Token_Plan"
base_url = "https://token-plan.maas.qianwenaiapi.com/compatible-mode/v1"
env_key = "OPENAI_API_KEY"
wire_api = "responses"
~/.codex/model-catalog.local.json,写入该套餐支持的模型:
复制
{
"models": [
{
"slug": "auto",
"display_name": "auto",
"description": "DashScope model: auto",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 1,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "qwen3.8-max",
"display_name": "qwen3.8-max",
"description": "DashScope model: qwen3.8-max",
"default_reasoning_level": "xhigh",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 983616,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": true,
"input_modalities": ["text", "image"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 1,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "qwen3.8-flash",
"display_name": "qwen3.8-flash",
"description": "DashScope model: qwen3.8-flash",
"default_reasoning_level": "xhigh",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 983616,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": true,
"input_modalities": ["text", "image"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 2,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "qwen3.7-max",
"display_name": "qwen3.7-max",
"description": "DashScope model: qwen3.7-max",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 3,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "qwen3.7-plus",
"display_name": "qwen3.7-plus",
"description": "DashScope model: qwen3.7-plus",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": true,
"input_modalities": ["text", "image"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 4,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "qwen3.6-flash",
"display_name": "qwen3.6-flash",
"description": "DashScope model: qwen3.6-flash",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": true,
"input_modalities": ["text", "image"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 5,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "glm-5.3",
"display_name": "glm-5.3",
"description": "DashScope model: glm-5.3",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 6,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "glm-5.2",
"display_name": "glm-5.2",
"description": "DashScope model: glm-5.2",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 7,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "deepseek-v4.1-flash",
"display_name": "deepseek-v4.1-flash",
"description": "DashScope model: deepseek-v4.1-flash",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": true,
"input_modalities": ["text", "image"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 8,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "deepseek-v4-pro",
"display_name": "deepseek-v4-pro",
"description": "DashScope model: deepseek-v4-pro",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 163840,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 9,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "deepseek-v4-pro-0813",
"display_name": "deepseek-v4-pro-0813",
"description": "DashScope model: deepseek-v4-pro-0813",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 163840,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 10,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "deepseek-v4-flash-0731",
"display_name": "deepseek-v4-flash-0731",
"description": "DashScope model: deepseek-v4-flash-0731",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 11,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "qwen3.6-plus",
"display_name": "qwen3.6-plus",
"description": "DashScope model: qwen3.6-plus",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": true,
"input_modalities": ["text", "image"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 12,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "deepseek-v4-flash",
"display_name": "deepseek-v4-flash",
"description": "DashScope model: deepseek-v4-flash",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 163840,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 13,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "deepseek-v3.2",
"display_name": "deepseek-v3.2",
"description": "DashScope model: deepseek-v3.2",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 163840,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 14,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "kimi-k2.7-code",
"display_name": "kimi-k2.7-code",
"description": "DashScope model: kimi-k2.7-code",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 262144,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": true,
"input_modalities": ["text", "image"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 15,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "kimi-k2.6",
"display_name": "kimi-k2.6",
"description": "DashScope model: kimi-k2.6",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 262144,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": true,
"input_modalities": ["text", "image"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 16,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "kimi-k2.5",
"display_name": "kimi-k2.5",
"description": "DashScope model: kimi-k2.5",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 262144,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": true,
"input_modalities": ["text", "image"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 17,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "glm-5.1",
"display_name": "glm-5.1",
"description": "DashScope model: glm-5.1",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 202752,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 18,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "glm-5",
"display_name": "glm-5",
"description": "DashScope model: glm-5",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 202752,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 19,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "MiniMax-M2.5",
"display_name": "MiniMax-M2.5",
"description": "DashScope model: MiniMax-M2.5",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 204800,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 20,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
}
]
}
~/.codex/config.toml 中添加以下配置指向该文件:
复制
model_catalog_json = "~/.codex/model-catalog.local.json"
codex -m 指定模型 ID(例如 codex -m qwen3.8-flash),或在 TUI 中输入 /model 在已配置的模型间切换。
Chat/Completions API(其他模型)
其他模型需通过 Chat/Completions API 接入,需安装旧版本 Codex,如 0.80.0(新版本 Codex 已不再支持 wire_api = "chat" 配置,升级后如遇报错请参见下文 FAQ):复制
npm install -g @openai/codex@0.80.0
复制
model_provider = "Model_Studio_Token_Plan"
model = "glm-5"
[model_providers.Model_Studio_Token_Plan]
name = "Model_Studio_Token_Plan"
base_url = "https://token-plan.maas.qianwenaiapi.com/compatible-mode/v1"
env_key = "OPENAI_API_KEY"
wire_api = "chat"
qwen3.8-max 思考模式说明:
- thinking:支持开启和关闭(混合思考模式)。
- temperature:思考模式下默认值为 0.6;传入值小于 0.6 时自动调整为 0.6。
- reasoning_effort:控制推理深度,可选 xhigh、medium、low,默认 xhigh。
按量计费
将OPENAI_API_KEY 环境变量设置为千问AI平台 API Key。可用模型参见支持的模型。
步骤一:配置环境变量
将OPENAI_API_KEY 环境变量设置为千问AI平台 API Key。
- macOS
- Windows
- 在终端中执行以下命令,查看默认 Shell 类型。
复制
echo $SHELL
- 根据 Shell 类型设置环境变量:
复制
# 将 YOUR_API_KEY 替换为千问AI平台 API Key
echo 'export OPENAI_API_KEY="YOUR_API_KEY"' >> ~/.zshrc
- 执行以下命令使环境变量生效。
复制
source ~/.zshrc
- CMD
- PowerShell
- 在 CMD 中运行以下命令,设置环境变量。
复制
REM 将 YOUR_API_KEY 替换为千问AI平台 API Key
setx OPENAI_API_KEY "YOUR_API_KEY"
- 打开一个新的 CMD 窗口,运行以下命令检查环境变量是否生效。
复制
echo %OPENAI_API_KEY%
- 在 PowerShell 中运行以下命令,设置环境变量。
复制
# 将 YOUR_API_KEY 替换为千问AI平台 API Key
[Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "YOUR_API_KEY", [EnvironmentVariableTarget]::User)
- 打开一个新的 PowerShell 窗口,运行以下命令检查环境变量是否生效。
复制
echo $env:OPENAI_API_KEY
步骤二:选择接入方式
根据模型支持的接入方式,选择以下一种配置:Responses API
适用于支持 OpenAI Responses API 的模型(如 qwen3.8-max),可使用最新版 Codex。复制
model_provider = "Model_Studio"
model = "qwen3.8-max"
[model_providers.Model_Studio]
name = "Model_Studio"
base_url = "https://maas.qianwenaiapi.com/compatible-mode/v1"
env_key = "OPENAI_API_KEY"
wire_api = "responses"
~/.codex/model-catalog.local.json,写入该套餐支持的模型:
复制
{
"models": [
{
"slug": "qwen3.8-max",
"display_name": "qwen3.8-max",
"description": "DashScope model: qwen3.8-max",
"default_reasoning_level": "xhigh",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 983616,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": true,
"input_modalities": ["text", "image"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 1,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "qwen3.7-max",
"display_name": "qwen3.7-max",
"description": "DashScope model: qwen3.7-max",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 2,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "deepseek-v4-pro",
"display_name": "deepseek-v4-pro",
"description": "DashScope model: deepseek-v4-pro",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 163840,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 3,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
},
{
"slug": "glm-5.2",
"display_name": "glm-5.2",
"description": "DashScope model: glm-5.2",
"default_reasoning_level": "medium",
"supported_reasoning_levels": [
{
"effort": "low",
"description": "Fast responses with lighter reasoning"
},
{
"effort": "medium",
"description": "Balances speed and reasoning depth"
},
{
"effort": "high",
"description": "Greater reasoning depth for complex problems"
},
{
"effort": "xhigh",
"description": "Extra high reasoning depth for complex problems"
}
],
"context_window": 1000000,
"effective_context_window_percent": 95,
"supports_parallel_tool_calls": false,
"supports_image_detail_original": false,
"input_modalities": ["text"],
"shell_type": "default",
"visibility": "list",
"supported_in_api": true,
"priority": 4,
"base_instructions": "",
"support_verbosity": false,
"supports_reasoning_summaries": false,
"experimental_supported_tools": [],
"truncation_policy": {
"mode": "bytes",
"limit": 10000
}
}
]
}
~/.codex/config.toml 中添加以下配置指向该文件:
复制
model_catalog_json = "~/.codex/model-catalog.local.json"
codex -m 指定模型 ID(例如 codex -m qwen3.8-max),或在 TUI 中输入 /model 在已配置的模型间切换。
Chat/Completions API
适用于仅支持 Chat/Completions API 的模型,需安装 Codex 0.80.0(新版本 Codex 已不再支持 wire_api = "chat" 配置,升级后如遇报错请参见下文 FAQ):复制
npm install -g @openai/codex@0.80.0
复制
model_provider = "Model_Studio"
model = "qwen3.6-plus"
[model_providers.Model_Studio]
name = "Model_Studio"
base_url = "https://maas.qianwenaiapi.com/compatible-mode/v1"
env_key = "OPENAI_API_KEY"
wire_api = "chat"
接入图像生成模型
通过 Codex 的 Skill 机制,可以调用 Token Plan 团队版的图像生成模型(qwen-image-2.0、wan2.7-image 等)。步骤一:创建 Skill
创建文件~/.codex/skills/token-plan-image/SKILL.md,完整复制以下内容并粘贴。
复制
---
name: "token-plan-image"
description: "Generate images from text descriptions using Token Plan's image generation API (qwen-image-2.0, wan2.7-image, etc.). Activate when the user asks to draw, generate, or create an image."
---
# Token Plan Image Generation
Generate images from text prompts via the Token Plan API.
## When to use
Activate this skill when the user requests image generation.
## Pipeline
1. Extract parameters from the user's request: prompt, model (default: qwen-image-2.0), size (default: 1024*1024).
2. Call the API with curl:
```bash
curl -s -X POST "https://token-plan.maas.qianwenaiapi.com/api/v1/services/aigc/multimodal-generation/generation" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"MODEL_NAME","input":{"messages":[{"role":"user","content":[{"text":"PROMPT_TEXT"}]}]},"parameters":{"size":"IMAGE_SIZE"}}'
```
3. Extract the image URL from the response JSON (located at output.choices[].message.content[].image).
4. Download the image with curl and report the saved file path to the user.
## Important
Do NOT attempt to view or read the generated image file. The model does not support image input and will error. Only report the file path.
步骤二:使用
在 Codex 中描述图像需求,Codex 会自动调用 token-plan-image Skill 生成图片。使用 Codex
- 新建一个终端,执行以下命令进入 Codex。
复制
codex
- 开始对话。如果正常进入对话界面,说明配置成功。
使用 CC Switch
CC Switch 是社区开源的桌面 GUI,支持在多个 API Key 或计费方案之间一键切换,无需手动修改~/.codex/config.toml。该工具为第三方软件,其脚本与代码不受千问AI平台审核和维护,安装使用前请自行评估其来源可信度与代码安全性。
安装
- macOS:执行
brew tap farion1231/ccswitch && brew install --cask cc-switch,或从 Releases 下载.dmg。 - Windows:从 Releases 下载
.msi安装包或便携版.zip。 - Linux:Arch 发行版执行
paru -S cc-switch-bin;其他发行版从 Releases 下载.deb/.rpm/.AppImage。
添加供应商
- 在 CC Switch 主界面顶部图标栏选中 Codex 图标,点击右上角 + 进入添加新供应商,按下表填入配置后点击添加。
| 计费方案 | 配置信息 |
|---|---|
| Token Plan 个人版 | 供应商名称:千问AI平台-Token Plan 个人版 API Key:工作台获取 请求地址: https://token-plan.maas.qianwenaiapi.com/compatible-mode/v1 |
| Token Plan 团队版 | 供应商名称:千问AI平台-Token Plan 团队版 API Key:工作台获取 请求地址: https://token-plan.maas.qianwenaiapi.com/compatible-mode/v1 |
| 按量计费 | 供应商名称:千问AI平台-按量计费 API Key:工作台获取 请求地址: https://maas.qianwenaiapi.com/compatible-mode/v1 |
-
展开高级选项填写模型名称,从对应方案支持的模型中选择,例如
qwen3.8-max。 -
回到主界面,点击该供应商右侧启用按钮,然后重新打开终端窗口执行
codex使配置生效。
常见问题
第三方工具提示"不支持国内模型"或"检查被拒 / Bad request (400)"怎么办?
原因:部分第三方管理工具(如 CC-Switch)在切换供应商时会发起"健康检查/连接测试"探测请求,该探测请求的格式与 Codex 实际调用的请求格式不同,千问AI平台网关可能因此返回 400 Bad request 并提示"检查被拒",工具据此显示"不支持国内模型"。此提示仅代表健康检查探测未通过,并不代表千问AI平台不支持国内模型,也不影响 Codex 的实际使用。千问AI平台支持通过 Codex 使用 qwen3.8-max、qwen3.7-max、qwen3.6-plus、qwen3.6-flash、glm-5 等国内模型,配置方式详见上文配置接入凭证。
~/.codex/config.toml 中完成配置,无需依赖第三方工具的健康检查结果;配置完成后参照使用 Codex启动 Codex,若能正常进入对话界面即表示可正常使用国内模型。
报错 wire_api 配置问题怎么办?
原因:Codex 新版本不再支持wire_api = "chat" 配置。根据版本不同,可能出现以下报错:
wire_api = "chat" is no longer supportedunknown configuration field wire_api
- 报错
wire_api = "chat" is no longer supported:将配置文件中的wire_api改为responses,并确认base_url配置正确。详见上文配置接入凭证中对应方案的配置示例。 - 报错
unknown configuration field wire_api:从配置文件~/.codex/config.toml的对应 provider 节中删除wire_api字段。
报错 unexpected status 401 Unauthorized 怎么办?
原因:- 误用了其他方案的 API Key(Token Plan 个人版、Token Plan 团队版和按量计费的 API Key 互不相通)
- 订阅过期
- API Key 复制不完整、有空格或拼写错误
- 确认使用的是所选方案的专属 API Key。
- 前往对应方案的管理页面确认订阅是否过期。
- 重新复制 API Key,确保完整且无空格。
- 如以上均正常仍报错,可在对应方案的管理页面重置 API Key,重置后请使用新 API Key 进行配置。
报错 unexpected status 404 Not Found 怎么办?
原因:配置文件中的base_url 或 wire_api 填写错误。
解决方案:确认 base_url 和 wire_api 与所选方案的配置一致。参见上文配置接入凭证中对应方案的配置示例。
报错 stream disconnected before completion: stream closed before response.completed 怎么办?
原因:Codex 与服务端的流式连接在响应完成前断开。常见于以下场景:- 对话线程过长,Codex 触发上下文压缩时请求失败
- 网络不稳定,SSE 或 WebSocket 连接中途断开
- 服务端过载或触发限流,提前终止连接
- 开启新的对话线程,避免单个线程积累过多上下文。
- 检查网络连接是否稳定,关闭 VPN 或代理后重试。
- 等待一段时间后重试,Codex 内置了自动重试机制,多数情况下重试可恢复。
报错 429 请求超频或额度用尽怎么办?
原因:429 错误有以下两种情形:- 请求超频(
429 Requests rate limit exceeded):短时间内请求过于密集。 - 限额用尽(
429 Allocated quota exceeded或Your token-plan quota has been exhausted):Token Plan 个人版的套餐月额度用尽。
- 请求超频:等待一分钟后重试,降低请求频率。
- 限额用尽:等待下一个订阅月额度自动重置;或购买用量包(套餐月额度用尽后自动抵扣用量包额度);或升级套餐。注意:报错信息中的重置时间(如
The quota will reset at HH:MM:SS UTC)以协调世界时(UTC)为准,换算为北京时间(CST)需加 8 小时。