Skip to content

liaoyl830/codex-responses-proxy-guide

Repository files navigation

Codex Responses Proxy Guide

Bridge OpenAI-compatible Chat Completions models into Codex through a Responses-compatible proxy.

简体中文 | 繁體中文 | English

license codex docker deployment

简体中文

这个仓库是一份通用部署方案:在云服务器、Windows 本机或 macOS 本机部署一个兼容层,让 Codex Desktop / Codex CLI 通过 OpenAI Responses API 调用国内主流 OpenAI Chat Completions 兼容模型。

已覆盖的典型模型/平台:

  • 阿里百炼 / Qwen,例如 qwen-plusqwen3.6-plus
  • DeepSeek,例如 deepseek-chatdeepseek-reasoner
  • MiniMax,例如 MiniMax-M2.7MiniMax-M2.5
  • 智谱 GLM,例如 glm-4.7glm-4.6glm-4.5
  • MiMo,例如 mimo-v2-promimo-v2.5-pro

核心思路:

Codex Desktop / CLI
  -> go-llm-proxy /v1/responses
  -> 国内模型厂商 /v1/chat/completions 或兼容 Chat Completions 地址
  -> 真实上游模型

Codex 侧可以把模型名写成 gpt-5.2 这样的别名,代理服务器再把它转发成真实上游模型,例如 qwen3.6-plusdeepseek-chatMiniMax-M2.7glm-4.7。这个别名只是为了让客户端更容易选择和调用,不代表实际请求的是 OpenAI GPT 模型。

已确认的兼容入口

平台 OpenAI 兼容 Base URL 示例模型
Qwen / 阿里百炼 https://dashscope.aliyuncs.com/compatible-mode/v1 qwen-plus, qwen3.6-plus
DeepSeek https://api.deepseek.com/v1 deepseek-chat, deepseek-reasoner
MiniMax https://api.minimax.io/v1 MiniMax-M2.7, MiniMax-M2.5
GLM / 智谱 https://open.bigmodel.cn/api/paas/v4 glm-4.7, glm-4.6, glm-4.5
MiMo https://api.mimo-v2.com/v1 或服务商提供的 OpenAI 兼容地址 mimo-v2-pro, mimo-v2.5-pro

更多说明见 Provider Catalog

适用场景

  • 你已有国内模型厂商的 API Key。
  • 你的上游模型主要提供 Chat Completions 兼容接口。
  • 你的 Codex 配置需要 wire_api = "responses"
  • 你希望上游 API Key 只保存在代理所在环境里,客户端只拿代理 Key。
  • 你想把多个模型统一聚合成一个 Codex 可调用入口。

准备条件

  • 选择一个运行环境:Linux 云服务器、Windows 电脑或 macOS 电脑。
  • 对应环境可用的 Docker 和 Docker Compose。
  • 至少一个上游模型 API Key。
  • 一个你自己生成的代理访问 Key。
  • 云服务器版可选:域名、HTTPS 证书、反向代理。
  • Windows / macOS 本机版:推荐安装 Docker Desktop,它自带 Docker Compose。

部署方式

你可以选择三种部署方式:

方式 访问地址 适合场景
云服务器版 https://api.example.com/v1http://YOUR_SERVER_IP:3002/v1 多台电脑/手机共用、长期在线、对外提供服务
Windows 本机版 http://127.0.0.1:3002/v1 只给当前 Windows 电脑上的 Codex 使用
macOS 本机版 http://127.0.0.1:3002/v1 只给当前 Mac 上的 Codex 使用

本机版默认只绑定 127.0.0.1,不会主动暴露到局域网。完整步骤见 Windows / macOS 本机部署

云服务器快速部署

  1. 克隆仓库:
git clone https://github.com/liaoyl830/codex-responses-proxy-guide.git
cd codex-responses-proxy-guide
  1. 复制配置:
cp config.example.yaml config.yaml
cp .env.example .env
  1. 编辑 config.yaml,保留你要启用的模型,替换这些占位符:
YOUR_QWEN_API_KEY
YOUR_DEEPSEEK_API_KEY
YOUR_MINIMAX_API_KEY
YOUR_GLM_API_KEY
YOUR_MIMO_API_KEY
YOUR_PROXY_API_KEY

推荐自己生成一个强随机代理 Key,例如:

openssl rand -hex 32
  1. 启动服务:
docker compose up -d

默认会把服务暴露到服务器的 3002 端口,客户端 Base URL 使用:

http://YOUR_SERVER_IP:3002/v1

生产环境建议使用 HTTPS,例如:

https://api.example.com/v1

Windows / macOS 本机快速部署

本机版使用只绑定 localhost 的 Compose 文件:

docker compose -f docker-compose.local.yml up -d

Codex 的 Base URL 使用:

http://127.0.0.1:3002/v1

Windows PowerShell:

$env:RESPONSES_PROXY_API_KEY="YOUR_PROXY_API_KEY"

macOS / Linux shell:

export RESPONSES_PROXY_API_KEY="YOUR_PROXY_API_KEY"

测试代理

先按部署方式选择 Base URL:

云服务器版:http://YOUR_SERVER_IP:3002/v1 或 https://api.example.com/v1
本机版:http://127.0.0.1:3002/v1

查看模型列表:

curl BASE_URL/models \
  -H "Authorization: Bearer YOUR_PROXY_API_KEY"

测试 Responses API:

curl BASE_URL/responses \
  -H "Authorization: Bearer YOUR_PROXY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.2",
    "input": "Say hello in one short sentence."
  }'

如果你想直接测试某个真实模型名,也可以把 model 改成 deepseek-chatMiniMax-M2.7glm-4.7mimo-v2-proqwen3.6-plus 等已经在 config.yaml 里暴露的名字。

Codex 配置示例

把下面配置放到 Codex 的 config.toml 里,按部署方式替换 base_url

云服务器版:http://YOUR_SERVER_IP:3002/v1 或 https://api.example.com/v1
本机版:http://127.0.0.1:3002/v1
model_provider = "responses_proxy"
model = "gpt-5.2"
web_search = "disabled"

[model_providers.responses_proxy]
name = "Responses Proxy"
wire_api = "responses"
base_url = "BASE_URL"
env_key = "RESPONSES_PROXY_API_KEY"

启动 Codex 前设置代理 Key:

export RESPONSES_PROXY_API_KEY="YOUR_PROXY_API_KEY"

Windows PowerShell:

$env:RESPONSES_PROXY_API_KEY="YOUR_PROXY_API_KEY"

模型别名

示例配置里同时提供两类名字:

  • gpt-5.2:给 Codex 使用的外部别名,默认映射到 Qwen。
  • 真实模型名:例如 qwen3.6-plusdeepseek-chatMiniMax-M2.7glm-4.7

如果你想把 gpt-5.2 改成 DeepSeek、MiniMax 或 GLM,只需要修改 config.yamlname: gpt-5.2 这一项的 backendapi_keymodel

安全建议

  • 不要把真实 API Key 写进 Git 仓库。
  • 云服务器版不要把代理端口裸露给全网长期使用,至少要开启代理 Key。
  • 云服务器生产环境建议加 HTTPS;本机版使用 127.0.0.1 时通常不需要 HTTPS。
  • 如果 Key 泄露,立刻在上游平台和代理配置里轮换。
  • 不同厂商的计费、上下文缓存、工具调用和限流策略不同,上线前要用真实工作流压测。
  • 这个方案是兼容层,不是 OpenAI、阿里云、DeepSeek、MiniMax、智谱或 MiMo 的官方产品。

更多内容见:

繁體中文

這個倉庫是一份通用部署方案:在雲端伺服器、Windows 本機或 macOS 本機部署一個相容層,讓 Codex Desktop / Codex CLI 透過 OpenAI Responses API 呼叫 OpenAI 相容的 Chat Completions 模型。

目前範例覆蓋的模型/平台:

  • 阿里百鍊 / Qwen,例如 qwen-plusqwen3.6-plus
  • DeepSeek,例如 deepseek-chatdeepseek-reasoner
  • MiniMax,例如 MiniMax-M2.7MiniMax-M2.5
  • 智譜 GLM,例如 glm-4.7glm-4.6glm-4.5
  • MiMo,例如 mimo-v2-promimo-v2.5-pro

核心架構:

Codex Desktop / CLI
  -> go-llm-proxy /v1/responses
  -> 上游模型平台 /v1/chat/completions 或相容 Chat Completions 端點
  -> 真實上游模型

Codex 端可以使用 gpt-5.2 這類外部別名,代理再把它轉發到真實上游模型,例如 qwen3.6-plusdeepseek-chatMiniMax-M2.7glm-4.7。這個別名只是為了讓 Codex 更容易選擇和呼叫,不代表實際請求的是 OpenAI GPT 模型。

快速開始

雲端伺服器:

git clone https://github.com/liaoyl830/codex-responses-proxy-guide.git
cd codex-responses-proxy-guide
cp config.example.yaml config.yaml
cp .env.example .env
docker compose up -d

Windows / macOS 本機:

git clone https://github.com/liaoyl830/codex-responses-proxy-guide.git
cd codex-responses-proxy-guide
cp config.example.yaml config.yaml
cp .env.example .env
docker compose -f docker-compose.local.yml up -d

本機版 Base URL:

http://127.0.0.1:3002/v1

雲端伺服器版 Base URL:

http://YOUR_SERVER_IP:3002/v1

生產環境建議使用 HTTPS:

https://api.example.com/v1

Codex 設定

model_provider = "responses_proxy"
model = "gpt-5.2"
web_search = "disabled"

[model_providers.responses_proxy]
name = "Responses Proxy"
wire_api = "responses"
base_url = "BASE_URL"
env_key = "RESPONSES_PROXY_API_KEY"

PowerShell:

$env:RESPONSES_PROXY_API_KEY="YOUR_PROXY_API_KEY"

macOS / Linux shell:

export RESPONSES_PROXY_API_KEY="YOUR_PROXY_API_KEY"

更多文件:

English

This repository provides a generic deployment guide for running a compatibility layer on a cloud server, Windows PC, or Mac. It bridges OpenAI-compatible Chat Completions models into Codex Desktop / Codex CLI through a Responses-compatible proxy.

Covered provider examples:

  • Alibaba Model Studio / Qwen, such as qwen-plus and qwen3.6-plus
  • DeepSeek, such as deepseek-chat and deepseek-reasoner
  • MiniMax, such as MiniMax-M2.7 and MiniMax-M2.5
  • Zhipu GLM, such as glm-4.7, glm-4.6, and glm-4.5
  • MiMo, such as mimo-v2-pro and mimo-v2.5-pro

Architecture:

Codex Desktop / CLI
  -> go-llm-proxy /v1/responses
  -> Provider /v1/chat/completions or compatible Chat Completions endpoint
  -> Real upstream model

Codex can request an alias such as gpt-5.2. The proxy rewrites that external model name to the real upstream model, such as qwen3.6-plus, deepseek-chat, MiniMax-M2.7, or glm-4.7. The alias is only a client-facing name; it does not mean the upstream model is an OpenAI GPT model.

Confirmed Compatible Endpoints

Provider OpenAI-compatible Base URL Example models
Qwen / Alibaba Model Studio https://dashscope.aliyuncs.com/compatible-mode/v1 qwen-plus, qwen3.6-plus
DeepSeek https://api.deepseek.com/v1 deepseek-chat, deepseek-reasoner
MiniMax https://api.minimax.io/v1 MiniMax-M2.7, MiniMax-M2.5
GLM / Zhipu https://open.bigmodel.cn/api/paas/v4 glm-4.7, glm-4.6, glm-4.5
MiMo https://api.mimo-v2.com/v1 or your provider's OpenAI-compatible endpoint mimo-v2-pro, mimo-v2.5-pro

See Provider Catalog for details.

Use Cases

  • You have API keys from one or more OpenAI-compatible model providers.
  • Your upstream model mainly exposes a Chat Completions compatible API.
  • Your Codex provider must use wire_api = "responses".
  • You want upstream API keys to stay in the environment where the proxy runs, while clients only use a proxy key.
  • You want one Codex-compatible endpoint for multiple upstream models.

Requirements

  • Choose one runtime: Linux cloud server, Windows PC, or Mac.
  • Docker and Docker Compose for that runtime.
  • At least one upstream model API key.
  • A strong proxy API key generated by you.
  • Cloud server optional: domain name, HTTPS certificate, and reverse proxy.
  • Windows / macOS local: Docker Desktop is the recommended install path and includes Docker Compose.

Deployment Modes

You can deploy this guide in three modes:

Mode Base URL Best for
Cloud server https://api.example.com/v1 or http://YOUR_SERVER_IP:3002/v1 Multiple devices, always-on usage, shared service
Windows local desktop http://127.0.0.1:3002/v1 Codex on the same Windows PC
macOS local desktop http://127.0.0.1:3002/v1 Codex on the same Mac

The local desktop mode binds only to 127.0.0.1 by default, so it is not exposed to your LAN. See Windows / macOS local deployment for full steps.

Cloud Server Quick Start

  1. Clone the repository:
git clone https://github.com/liaoyl830/codex-responses-proxy-guide.git
cd codex-responses-proxy-guide
  1. Copy the example files:
cp config.example.yaml config.yaml
cp .env.example .env
  1. Edit config.yaml, keep the models you want to enable, and replace:
YOUR_QWEN_API_KEY
YOUR_DEEPSEEK_API_KEY
YOUR_MINIMAX_API_KEY
YOUR_GLM_API_KEY
YOUR_MIMO_API_KEY
YOUR_PROXY_API_KEY

Generate a strong proxy key, for example:

openssl rand -hex 32
  1. Start the proxy:
docker compose up -d

By default, the service is exposed on server port 3002. The client Base URL is:

http://YOUR_SERVER_IP:3002/v1

For production, HTTPS is strongly recommended:

https://api.example.com/v1

Windows / macOS Local Quick Start

Use the localhost-only Compose file:

docker compose -f docker-compose.local.yml up -d

Use this Base URL in Codex:

http://127.0.0.1:3002/v1

Windows PowerShell:

$env:RESPONSES_PROXY_API_KEY="YOUR_PROXY_API_KEY"

macOS / Linux shell:

export RESPONSES_PROXY_API_KEY="YOUR_PROXY_API_KEY"

Test the Proxy

Choose a Base URL for your deployment mode first:

Cloud server: http://YOUR_SERVER_IP:3002/v1 or https://api.example.com/v1
Local desktop: http://127.0.0.1:3002/v1

List models:

curl BASE_URL/models \
  -H "Authorization: Bearer YOUR_PROXY_API_KEY"

Test the Responses API:

curl BASE_URL/responses \
  -H "Authorization: Bearer YOUR_PROXY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.2",
    "input": "Say hello in one short sentence."
  }'

To test a real upstream model name directly, set model to a name exposed in config.yaml, such as deepseek-chat, MiniMax-M2.7, glm-4.7, mimo-v2-pro, or qwen3.6-plus.

Codex Configuration

Add a custom provider to your Codex config.toml and replace base_url for your deployment mode:

Cloud server: http://YOUR_SERVER_IP:3002/v1 or https://api.example.com/v1
Local desktop: http://127.0.0.1:3002/v1
model_provider = "responses_proxy"
model = "gpt-5.2"
web_search = "disabled"

[model_providers.responses_proxy]
name = "Responses Proxy"
wire_api = "responses"
base_url = "BASE_URL"
env_key = "RESPONSES_PROXY_API_KEY"

Set the proxy key before starting Codex:

export RESPONSES_PROXY_API_KEY="YOUR_PROXY_API_KEY"

Windows PowerShell:

$env:RESPONSES_PROXY_API_KEY="YOUR_PROXY_API_KEY"

Model Aliases

The example config exposes two kinds of model names:

  • gpt-5.2: a client-facing Codex alias, mapped to Qwen by default.
  • Real upstream names, such as qwen3.6-plus, deepseek-chat, MiniMax-M2.7, and glm-4.7.

To map gpt-5.2 to DeepSeek, MiniMax, or GLM instead, edit the name: gpt-5.2 entry in config.yaml and change its backend, api_key, and model.

Security Notes

  • Never commit real API keys to Git.
  • For cloud deployments, do not expose the proxy publicly without authentication.
  • Use HTTPS for cloud production deployments. HTTPS is usually unnecessary for localhost-only desktop deployments.
  • Rotate upstream and proxy keys immediately if they are leaked.
  • Provider billing, context caching, tool calling, and rate limits differ. Test with your real Codex workflow before production use.
  • This is a compatibility-layer deployment guide, not an official OpenAI, Alibaba Cloud, DeepSeek, MiniMax, Zhipu, or MiMo product.

More docs:

License

MIT

About

Deployment guide for bridging OpenAI-compatible Chat Completions models to Codex through a Responses-compatible proxy.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors