Codex CLI
Codex CLI is OpenAI’s open-source local coding agent. Register ApiGo as a custom model provider and launch with a profile.
Prerequisites
- Node.js and npm
- An ApiGo API key from Workspace → API Keys
- A model ID from the Model Catalog
Install
npm i -g @openai/codex
Clear conflicting OpenAI exports before configuring:
unset OPENAI_BASE_URL OPENAI_API_KEY
Configure ~/.codex/config.toml
model_provider = "apigo"
model = "gpt-5.6-sol"
[model_providers.apigo]
name = "ApiGo"
base_url = "https://api.apigo.ai/v1"
env_key = "APIGO_API_KEY"
wire_api = "chat"
requires_openai_auth = false
request_max_retries = 4
stream_max_retries = 10
stream_idle_timeout_ms = 300000
[profiles.apigo]
model = "gpt-5.6-sol"
model_provider = "apigo"
Replace the model IDs with slugs from your catalog.
Set your API key
export APIGO_API_KEY="sk-apigo-..."
Add the export to ~/.zshrc / ~/.bashrc for persistence. On Windows, set a user environment variable and restart the terminal (and the Codex desktop app if you use it).
Optional: command-based auth
If your Codex build supports fetching a remote model catalog, prefer command-based auth:
[model_providers.apigo.auth]
command = "sh"
args = ["-c", "echo $APIGO_API_KEY"]
On Windows PowerShell:
[model_providers.apigo.auth]
command = "powershell"
args = ["-NoProfile", "-Command", "Write-Output $env:APIGO_API_KEY"]
Start Codex
cd /path/to/your/project
codex --profile apigo
Or, if you set model_provider = "apigo" at the top level:
codex
Configuration reference
| Setting | Purpose |
|---|---|
model_provider |
Must match the [model_providers.*] block name (apigo) |
model |
Exact model slug from the ApiGo catalog |
base_url |
Always https://api.apigo.ai/v1 |
wire_api |
Use chat for Chat Completions |
Troubleshooting
| Symptom | Fix |
|---|---|
| Unknown model warning | Confirm the slug on Models; try command-based auth |
| Auth failures | Ensure APIGO_API_KEY is exported in the same shell that launches codex |
| Requests bypass ApiGo | Unset OPENAI_BASE_URL / OPENAI_API_KEY |
