Coder powers secure, scalable development across key industries — automotive, finance, government, and technology — enabling faster builds, tighter compliance, and seamless AI adoption in enterprise-grade cloud environments.
# Your personal OpenAI API key, forwarded to OpenAI.
export OPENAI_API_KEY="<your-openai-api-key>"
# Your Coder API token, used for authentication with AI Gateway.
export CODER_API_TOKEN="<your-coder-api-token>"
BYOK (ChatGPT Subscription)
Add the following to your Codex configuration file (e.g., ~/.codex/config.toml):
The base_url uses /aibridge/chatgpt/v1 instead of /aibridge/openai/v1 to route requests through the ChatGPT provider.
Set your Coder API token and ensure OPENAI_API_KEY is not set:
# Your Coder API token, used for authentication with AI Gateway.
export CODER_API_TOKEN="<your-coder-api-token>"
# Ensure no OpenAI API key is set so Codex uses ChatGPT login instead.
unset OPENAI_API_KEY
When you run Codex, it will prompt you to log in with your ChatGPT account.
Pre-configuring in Templates
If configuring within a Coder workspace, you can use the
Codex CLI module:
module "codex" {
source = "registry.coder.com/coder-labs/codex/coder"
version = "~> 4.1"
agent_id = coder_agent.main.id
workdir = "/path/to/project" # Set to your project directory
enable_ai_gateway = true
}