Connect AI1API to Codex CLI
Codex CLI uses the same .codex configuration path and Responses protocol as Codex Desktop.
Prerequisites
- Codex Desktop is installed
- An API Key exists and is bound to an available group
Setup steps
Step 1: Create an API Key
Open API Keys in the AI1API console and create a key for the group you want to use. Never share the full key in tickets, screenshots, or repositories.
Step 2: Configure Codex
Use ~/.codex/config.toml on macOS/Linux or %USERPROFILE%\.codex\config.toml on Windows. The console Use API Key dialog can generate the file.
~/.codex/config.toml
model_provider = "ai1api"
model = "gpt-5.6-sol"
review_model = "gpt-5.6-sol"
model_reasoning_effort = "xhigh"
[model_providers.ai1api]
name = "AI1API"
base_url = "https://ai1api.com/v1"
wire_api = "responses"
requires_openai_auth = trueStep 3: Add the API Key
Replace the placeholder with your own key and keep it in a local config file only.
~/.codex/auth.json
{
"OPENAI_API_KEY": "sk-your-key"
}Verify the connection
Start with the smallest request, then enable streaming and tools after the connection works.
Minimal Responses check
curl https://ai1api.com/v1/responses \
-H "Authorization: Bearer $AI1API_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.6-sol","input":"Reply with OK","stream":false}'Notes
- Use the model and group shown by live pricing and the console.
- A 403 usually means that the key is not bound to a group that allows Responses.