Skip to Content

Using with Codex CLI - MyTokenGate

Codex CLI  is OpenAI’s official terminal coding assistant. It supports custom model providers, so you can point requests at MyTokenGate’s OpenAI-compatible API.

Install Codex CLI

npm install -g @openai/codex

Configure MyTokenGate

Codex CLI 0.95 and above only supports the Responses API. MyTokenGate’s gateway already supports /v1/responses, so you don’t need to configure wire_api.

Edit ~/.codex/config.toml, add a provider pointing at MyTokenGate, and set it as the default:

model = "gpt-5.4" model_provider = "mytokengate" [model_providers.mytokengate] name = "MyTokenGate" base_url = "https://gateway.mytokengate.com/v1" env_key = "MYTOKENGATE_API_KEY"

env_key names the environment variable to read the key from. Set it in your shell profile:

export MYTOKENGATE_API_KEY="your-api-key-here" # Get it from https://mytokengate.com/app/dashboard

Once configured, just run:

codex

Model Selection

Change model in config.toml to whichever model you need:

  • gpt-5.4 - General workhorse
  • gpt-5.6-sol - Flagship, for complex tasks
  • gpt-6-astra - Newest flagship
  • claude-sonnet-5 - Balanced default
  • See more at Model List 

Known Limitations

  • The gateway does not support previous_response_id and stores no conversation state on the server. Codex does not use this parameter by default, so it is unaffected.
  • Codex’s built-in web_search tool is unavailable on non-OpenAI models: built-in tools are dropped when the gateway converts the request.
  • The gpt-6 family cannot turn reasoning off: when the client sets the effort to none/minimal, the gateway omits the reasoning field and the upstream model runs at its default effort.

Usage Tips

  • Use codex "describe your task" for one-off instructions
  • For complex changes, ask for a plan first, then approve before it executes
  • Monitor usage and spend in the MyTokenGate Console
Last updated on