Routescope APIRoutescope API
Client Tool Setup

Codex

Codex setup guide covering key generation, config.toml / auth.json, and troubleshooting

Keep these values handy

The examples below use the official Routescope deployment:

  • OpenAI-compatible Base URL: https://api.routescope.ai/v1
  • API Key: the full sk-... secret copied from the console
  • Model: choose a model enabled for your account, such as gpt-5.4

Step 1: Create a Key in Routescope

  1. Open your Routescope console and sign in.
  2. Follow Get Base URL and API Key to open token management.
  3. Click Add Token and enter a token name.
  4. If needed, configure quota, allowed models, IP restrictions, and expiration.
  5. After saving, copy the full secret from the token list. If you need endpoint or auth details, open the auth information entry on the page.

Important

Use the full secret directly. Do not remove the sk- prefix.

Step 2: Parameter Mapping

ScenarioFieldValueNotes
Codex CLIbase_url in config.tomlhttps://api.routescope.ai/v1/v1 is required here
Codex CLIOPENAI_API_KEY in auth.jsonsk-...Use the full secret
Generic OpenAI-compatible clientsBase URL / API Base / Endpointhttps://api.routescope.ai/v1Tools such as Cursor, Cline, and Cherry Studio usually use this
Any clientModelgpt-5.4 or another account-available modelDo not force a model your account cannot access

Step 3: Configure Codex

1. Locate the Codex Config Directory

~/.codex/
%USERPROFILE%\.codex\

2. Put This at the Top of config.toml

model_provider = "OpenAI"
model = "gpt-5.4"
review_model = "gpt-5.4"
model_reasoning_effort = "xhigh"
disable_response_storage = true
network_access = "enabled"
windows_wsl_setup_acknowledged = true
model_context_window = 1000000
model_auto_compact_token_limit = 900000

[model_providers.OpenAI]
name = "OpenAI"
base_url = "https://api.routescope.ai/v1"
wire_api = "responses"
requires_openai_auth = true

3. Create or Overwrite auth.json

{
  "OPENAI_API_KEY": "sk-your-full-secret"
}

4. Field Reference

FileFieldValueNotes
config.tomlmodel_providerOpenAIKeep as shown
config.tomlmodelgpt-5.4 or an available modelDefault chat model
config.tomlreview_modelgpt-5.4 or an available modelReview model, can match the main model
config.tomlbase_urlhttps://api.routescope.ai/v1/v1 is required
config.tomlwire_apiresponsesKeep as shown
auth.jsonOPENAI_API_KEYFull sk-... secretCopy from token management

If your account does not have gpt-5.4, replace model and review_model with a model that is actually available.

Step 4: Verify the Setup

The simplest verification is to request the model list:

curl https://api.routescope.ai/v1/models \
  -H "Authorization: Bearer sk-your-token"

If the model list returns normally, the key and gateway endpoint are configured correctly.

FAQ

Why does config.toml need /v1?

Codex uses an OpenAI-compatible endpoint, so base_url must include the version path: https://api.routescope.ai/v1.

Why am I getting 401 / 403?

Check whether the copied secret is the full sk-... value, whether the token is disabled, expired, out of quota, whether the model is allowed by the token, and whether IP restrictions are blocking the request.

Why am I getting 404?

The most common cause is an incorrect endpoint. Codex base_url and generic OpenAI-compatible clients should use https://api.routescope.ai/v1.

How is this guide?

Last updated on