This project was written by AI. Use it at your own risk.
codex-oauth-proxy forwards Codex requests through managed API keys using OAuth
credentials from Codex CLI.
- Proxies Codex CLI and supported OpenAI-compatible requests.
- Provides a focused Zed Edit Prediction endpoint for Qwen FIM prompts.
- Manages
cop_...API keys for proxy users. - Uses health-aware Codex OAuth failover, cooldowns, and coordinated token refresh.
- Persists tenant-scoped session affinity without storing raw session identifiers.
- Records per-user token usage and provides an optional Grafana dashboard.
Build the proxy:
go build -o codex-oauth-proxy ./cmd/server
cp config.example.yaml config.yaml
codex-oauth-proxy --config config.yamlIn another terminal, create a managed user:
codex-oauth-proxy admin users create aliceThe command prints the generated API key once. Configure Codex CLI to use it:
model_provider = "proxy"
chatgpt_base_url = "http://127.0.0.1:8317/backend-api/"
[model_providers.proxy]
name = "Codex OAuth Proxy"
base_url = "http://127.0.0.1:8317/v1"
env_key = "COP_API_KEY"
wire_api = "responses"
supports_websockets = true
requires_openai_auth = falseexport COP_API_KEY="cop_..."
codexThe local admin CLI calls a loopback-only endpoint and does not require
admin-api-key. Set admin-api-key only when remote management API or Grafana
access is needed.
For containers, set host: "0.0.0.0" in config.yaml, place Codex OAuth JSON
files under ./auths, and start the service:
docker compose up -dRun local administration inside the container:
docker exec codex-oauth-proxy \
/codex-oauth-proxy/codex-oauth-proxy admin users create aliceSee Getting Started for native and Docker setup details.
- Getting Started
- Configuration
- Administration
- API Reference
- Usage and Observability
- Architecture
- Development
Licensed under the Apache License, Version 2.0. See LICENSE.