Skip to content

Connect Codex CLI ​

Select the OpenAI-compatible API address in the dashboard and copy the base URL ending in /v1. Choose a model ID supporting Responses from the public price list.

Set your provider in ~/.codex/config.toml. Replace the placeholders with the address and exact model ID from the site.

toml
model = "YOUR_MODEL_ID"
model_provider = "ai_router"

[model_providers.ai_router]
name = "AI Router"
base_url = "https://YOUR_SITE/v1"
wire_api = "responses"
env_key = "AI_ROUTER_API_KEY"

Set the AI_ROUTER_API_KEY environment variable to your site API key in the terminal where you run codex. Once you receive a reply, find the request in usage history. For a 401 response, check that the key belongs to this site and that it is active and unexpired.

See the Codex configuration reference for additional provider settings.