让 Codex App 通过 CC Switch 使用阶跃星辰 StepFun API。
这个项目提供一个 macOS 一键安装脚本:
Codex App / CC Switch -> 本地 /v1/responses adapter -> StepFun /chat/completions
它适用于 StepFun 普通订阅和 Step-Plan 订阅。安装完成后,重启一次 Codex App 即可使用。
- macOS
- Codex App / Codex CLI
- CC Switch
- StepFun 普通订阅:
https://api.stepfun.com/v1/chat/completions - Step-Plan 订阅:
https://api.stepfun.com/step_plan/v1/chat/completions
默认模型:
- 普通订阅:
step-3.5-flash-2603 - Step-Plan:
step-router-v1
脚本运行时也可以选择 step-3.5-flash。
推荐先下载脚本、检查内容,再执行:
curl -fsSL https://raw.githubusercontent.com/LearnPrompt/stepfun-codex-adapter/main/install_stepfun_codex_adapter.sh -o install_stepfun_codex_adapter.sh
chmod +x install_stepfun_codex_adapter.sh
./install_stepfun_codex_adapter.sh脚本会引导你选择:
- 普通订阅或 Step-Plan 订阅
- 模型
- StepFun API Key
如果没有安装 CC Switch 或 Codex,脚本会尝试自动安装。
./install_stepfun_codex_adapter.sh --uninstall卸载会:
- 停止并删除本地 LaunchAgent
- 删除本地 adapter 脚本
- 从 CC Switch 删除
StepFun Codex Adapterprovider - 尝试切回安装前的 Codex provider
- 恢复安装前备份的 Codex 配置
安装脚本会写入或更新这些本地文件:
~/.cc-switch/stepfun_codex_adapter.py~/.cc-switch/stepfun-codex-adapter-config.json~/.cc-switch/stepfun-codex-model-catalog.json~/.cc-switch/stepfun-codex-adapter-state.json~/.cc-switch/cc-switch.db~/.codex/config.toml~/Library/LaunchAgents/com.stepfun.codex-adapter.plist
安装前会备份:
~/.codex/config.toml~/.codex/auth.json~/.cc-switch/cc-switch.db
备份目录位于:
~/.cc-switch/backups/stepfun-codex-adapter/
脚本会把 StepFun API Key 写入本机 CC Switch 的 StepFun Codex Adapter provider 配置。本地 adapter 会从 CC Switch 数据库读取 key 并转发给 StepFun;不会要求 Codex 进程设置 OPENAI_API_KEY,也不会把 StepFun key 写入 ~/.codex/auth.json。
不要把安装后的本地配置文件上传到公开仓库。
这个项目不是完整 OpenAI Responses API 代理。它只覆盖 Codex App 常用路径:
GET /healthGET /v1/modelsPOST /v1/responsesPOST /responses- 文本输入/输出
- 基础 SSE 事件:
response.created、response.output_text.delta、response.completed - 函数工具调用:Responses
tools与 Chat Completionstool_calls的基础转换 - usage token 字段基础映射
已知不完整能力:
- 图片、音频、视频等多模态输入会被降级为占位文本或忽略。
- Responses 内置工具,例如
web_search、file_search、computer_use,不会由 adapter 执行。 reasoning、reasoning summaries、response storage、previous_response_id、后台任务、状态恢复不支持。- 结构化输出、JSON schema 严格模式、复杂
response_format不保证支持。 - 上游 StepFun 请求当前是非流式;adapter 会在上游完整返回后再向 Codex 发 SSE,因此首 token 延迟会高于真流式。
实际使用上,常规代码问答、编辑、命令调用和基础函数工具调用是主要目标。
检查 adapter 是否启动:
curl http://127.0.0.1:18667/health查看当前模型:
curl http://127.0.0.1:18667/v1/models日志路径:
~/.cc-switch/logs/stepfun-codex-adapter.log
~/.cc-switch/logs/stepfun-codex-adapter.err.log
如果需要切回 GPT / OpenAI Official:
- 在 CC Switch 里启用 OpenAI Official。
- 重启 Codex App。
- 如需清理本地 adapter,运行
./install_stepfun_codex_adapter.sh --uninstall。
MIT