Skip to content

Connect Codex to Apertis

Run the Codex CLI through Apertis with one API key. Define Apertis as a custom model provider in config.toml, select a current model from the live catalog, and verify one small request plus its usage record before a larger task.

Before you configure Codex

No card is required to create an account. Choose a Coding Plan or add PAYG balance before your first API request.

  1. Create an Apertis account.
  2. Choose current access on the Coding Plans page or add PAYG balance in Credits.
  3. Create a scoped key in API Keys. Keep the full key out of source control and logs.

Configure the OpenAI-compatible provider

Export your Apertis key as APERTIS_API_KEY, then add an apertis table under model_providers in ~/.codex/config.toml with the Apertis base URL and the Responses wire API, and select it with model_provider.

Follow the tool’s current official provider guide if its labels or config format differ from the example below.

# ~/.codex/config.toml
# export APERTIS_API_KEY=YOUR_APERTIS_API_KEY
model_provider = "apertis"
model = "YOUR_MODEL_ID"

[model_providers.apertis]
name = "Apertis"
base_url = "https://api.apertis.ai/v1"
env_key = "APERTIS_API_KEY"
wire_api = "responses"

Select a current model

Model IDs, availability, capabilities, and pricing change faster than a static setup guide. Copy the exact ID from the live model catalog and replace YOUR_MODEL_ID in your tool configuration.

Verify the first successful API call

Send one small request through Codex. A completed setup is a model response followed by a matching request record in Activity—not account creation alone.

curl -sS https://api.apertis.ai/v1/chat/completions \
  -H "Authorization: Bearer $APERTIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"YOUR_MODEL_ID","messages":[{"role":"user","content":"Reply with OK"}]}'

Common setup failures

ErrorWhat it usually meansNext step
401 UnauthorizedThe API key is missing, expired, or entered incorrectly.Create or replace the key, then retry without exposing it in logs.
404 Model Not FoundThe selected model ID is unavailable for the current access path.Copy a current model ID from the live Apertis model catalog.
429 Too Many RequestsThe request reached a rate or quota boundary.Review the current plan, PAYG balance, and key quota before retrying.
Tool call failedThe selected model or endpoint may not support the tool pattern.Choose a model with the required capability in the live catalog.

Start with one workload

Validate one model response and its usage record before moving more agents or repositories onto the same path.

No card is required to create an account. Choose a Coding Plan or add PAYG balance before your first API request.