Skip to main content
Codex CLI supports custom model providers in ~/.codex/config.toml. SnapGen’s /v1/responses route was verified with the current Codex CLI and GPT text models.

Prerequisites

  • Install or update Codex CLI and confirm codex --version works.
  • Create a SnapGen API key and add prepaid balance.
  • Use a current text model. gpt-5.4-mini is the lowest-cost starting point.

Set the API key

Add that export to your shell profile or load it from a secret manager. Do not put the key directly in config.toml.

Add the provider

Edit ~/.codex/config.toml:
wire_api must be responses. Current Codex versions do not use Chat Completions for custom agent sessions.

Verify

The startup summary should show provider: snapgen and your selected model. Use codex for an interactive session.

Switch models

Change the top-level model value, or override it for one run:
Current model IDs include gpt-5.4, gpt-5.4-mini, gpt-5.5, gpt-5.6, gpt-5.6-luna, gpt-5.6-sol, and gpt-5.6-terra.

Troubleshooting

Confirm model_provider = "snapgen" is at the top level and the provider block has the same snapgen identifier.
Export SNAPGEN_API_KEY in the shell that launches Codex. The env_key field names the variable; it does not contain the secret itself.
Set wire_api = "responses" and update Codex CLI. Do not use chat with a current version.
Custom inference routes do not authenticate hosted ChatGPT services. Core Codex agent requests can work while optional OpenAI-hosted features remain unavailable.