@heungtae/codex-chat-bridge
v0.4.15
Published
Responses-to-chat/completions bridge for Codex workflows
Readme
codex-chat-bridge
Tiny local bridge for running Codex and Claude Code against OpenAI-compatible upstreams without patching either client.
What It Is
- Codex: OpenAI's local coding agent. It is configured through Codex profile config files and can call a custom
model_provider. - Claude Code: Anthropic's coding agent. It sends Anthropic
/v1/messagestraffic. - codex-chat-bridge: A local adapter that accepts Responses, Chat Completions, and Anthropic Messages requests, then forwards them to a configured upstream as
/v1/responses,/v1/chat/completions, or/v1/messages.
Install
npm install -g @heungtae/codex-chat-bridgeThe npm package builds a Rust binary during install. You need Node.js 20+, npm 10+, and a Rust toolchain.
Quick Start
Create the bridge config:
mkdir -p ~/.config/codex-chat-bridge
cp conf.toml.example ~/.config/codex-chat-bridge/conf.tomlRun the bridge:
export OPENROUTER_API_KEY=sk-...
codex-chat-bridge --config ~/.config/codex-chat-bridge/conf.tomlUse Codex 0.134.0+ with a separate profile file. Do not put legacy [profiles.*] blocks or profile = "..." in ~/.codex/config.toml.
codex --profile chat-bridgeFull setup:
- Codex 0.134.0 profile configuration
- Example bridge config
- OpenAI Codex config reference
- OpenAI Codex repository
Bridge Behavior
responses -> chat: maps Codex Responses traffic to Chat Completions upstreams.chat -> responses: maps Chat Completions clients to Responses upstreams.anthropic -> chat: maps Claude Code/v1/messagestraffic to Chat Completions upstreams.messages -> messages: bypasses Anthropic Messages traffic to native/v1/messagesupstreams without payload conversion while keeping configured upstream headers, forwarded incoming headers, and configured upstream model overrides.namespace,custom,mcp, andweb_search*tools can be converted into chatfunctiontools whentool_transform_mode = "legacy_convert".
Minimal Router
[routers.chat_bridge]
incoming_url = "http://127.0.0.1:8787/chat-bridge/v1/responses"
upstream_url = "https://openrouter.ai/api/v1/chat/completions"
upstream_wire = "chat"Codex provider base_url must stop at /v1; Codex appends /responses itself:
base_url = "http://127.0.0.1:8787/chat-bridge/v1"
wire_api = "responses"