Skip to content

Use Codex CLI with amazee.ai

Codex CLI is OpenAI's open-source terminal coding agent. Connect it to amazee.ai to route requests through your regional endpoint with full budget controls and data residency.

Prerequisites

Connect Codex CLI to amazee.ai

Step 1 — Configure the provider

Create or edit ~/.codex/config.toml:

model_provider = "openai"
model = "claude-sonnet-4-5"

[model_providers.openai]
name = "openai"
base_url = "https://llm.[your-region].amazee.ai/v1"
env_key = "AMAZEEAI_API_KEY"

Replace [your-region] with your region code (e.g. ch103, us103, de103).

Step 2 — Set your API key

Add to your shell profile (~/.zshrc, ~/.bashrc, or ~/.config/fish/config.fish):

export AMAZEEAI_API_KEY="your-api-key-here"

Then reload your shell:

source ~/.zshrc   # or ~/.bashrc

Step 3 — Start Codex

cd /path/to/your/project
codex

Switching models

Change the model value in config.toml to any model from Available Models:

model = "claude-sonnet-4-5"

Troubleshooting

Auth errors : Make sure AMAZEEAI_API_KEY is set. Run echo $AMAZEEAI_API_KEY to verify.

Model not found : Use the exact model ID from Available Models.

Connection errors : Verify your base URL is correct and includes /v1.