Docs contents

Use Codex CLI with GoiAPI

Set up Codex CLI with a custom model provider in ~/.codex/config.toml, keep your API key in an environment variable, then send a test prompt from the terminal.

Ask AI and more
View as Markdown

Step 1: Before you start

  • An API key: sign up, top up your balance, then create a key in the dashboard. Put your key where <API_KEY> appears below.
  • The name of the model you want to use, from Models. The examples below use claude-haiku-5-5.

Step 2: Set up Codex CLI

For people already using Codex: add a model_providers entry to the config file (newer Codex versions use the Responses API: wire_api = "responses"), then put your key in an environment variable.

File ~/.codex/config.toml

TOML
model = "claude-haiku-5-5"
model_provider = "gateway"

[model_providers.gateway]
name = "GoiAPI"
base_url = "https://api.goiapi.com/v1"
env_key = "GATEWAY_API_KEY"
wire_api = "responses"

macOS / Linux: then run codex

Terminal
export GATEWAY_API_KEY="<API_KEY>"
codex

Step 3: Send a test message

Send a short message (for example "Hello") from Codex CLI. The Request history page in the dashboard shows the request as soon as it happens, with token counts and cost.

If something fails, see Error codes: 401 means the key is wrong or missing, 402 means your balance is too low, 404 means the model name is wrong.