Codex
Connect OpenAI Codex to SwatowAPI. Codex talks over the OpenAI-compatible Responses API (wire_api = "responses"), so the group platform of the key you call with must be OpenAI. The base URL is https://swato.ai/v1.
Prerequisites
- Create an API key whose group platform is OpenAI in the console. For how the group platform decides routing, see Authentication.
- Codex CLI (or the IDE extension) installed locally.
- Base URL:
https://swato.ai/v1.
Configure
Use environment variables for a quick connectivity check, then move the settings into ~/.codex/config.toml to persist them (recommended; the CLI and IDE extension share this file).
export OPENAI_API_KEY="sk_your_swatowapi_key"
export OPENAI_BASE_URL="https://swato.ai/v1"
codexmodel_provider = "SwatowAPI"
model = "gpt-5.3-codex"
review_model = "gpt-5.3-codex"
model_reasoning_effort = "high"
disable_response_storage = true
network_access = "enabled"
[model_providers.SwatowAPI]
name = "SwatowAPI"
base_url = "https://swato.ai/v1"
wire_api = "responses"
requires_openai_auth = true
[features]
goals = trueTIP
Replace gpt-5.3-codex with the current Codex model id from the console or GET /v1/models. Model ids change across releases, so do not treat this one as permanent.
One-click script
The one-click script is not a public download: a working script has your chosen key embedded in it. On the console API Key page, click "Use key" on a key, switch to the "Codex one-click script" tab, and copy or download the macOS/Linux or Windows script. It backs up your existing Codex config before overwriting.
CLI
Run a read-only task first to confirm auth, routing, and network before handing it write tasks.
cd /path/to/your/project
codex "Read the project structure only, and summarize the main modules of this project."IDE extension
The IDE extension reads the same ~/.codex/config.toml.
- Confirm the Base URL and key in the config are correct.
- Restart the IDE so the extension reloads the config.
- Run a read-only task first.
MCP and AGENTS.md
MCP servers (optional) are declared in the config to connect external tools or data:
[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp"]AGENTS.md records repo-level collaboration rules (what Codex should do in this repo). It is distinct from MCP, which is about external tools and data.
Verify
Confirm the link is working by checking three things:
- Client: Codex starts and reads the project.
- Gateway: requests hit the site's
/v1entry, not a system proxy or a stale config. - Ledger: the console usage log shows this call with model, latency, tokens, and charge.
Troubleshooting
- 401 / Unauthorized: the key must be one created on this site; the env var must be active in the current shell; the config's env_key name must match.
- Invalid base URL: it must include the scheme (e.g.
https://swato.ai/v1); do not use a bare domain and do not append/chat/completionsafter/v1. - IDE still hits the old address: restart the IDE and the extension window; check that no project-level config overrides
~/.codex/config.toml. - Request succeeds but no ledger record: confirm you used the same site domain and the same API key; local, staging, and prod ledgers do not mix.
