← Integrations · Terminal agents

Codex CLI setup via the Kiree gateway

Connect Codex CLI to kiree.net through ~/.codex/config.toml: an OpenAI-compatible provider, GPT models from the catalog, billed by tokens.

Why the gateway

Why the direct setup does not cover every case

Codex CLI normally calls the OpenAI endpoint directly. The gateway exposes an OpenAI-compatible endpoint; define a provider with the base URL and model in config.toml, so the agent goes through kiree.net in chat completions format.

Setup

Steps to your first request

·

Get a key

Create a sk-… key in the kiree.net console.

·

Create config.toml

File ~/.codex/config.toml (Windows: %USERPROFILE%\.codex\config.toml): provider kiree, base_url and model.

·

Set the key and check

export OPENAI_API_KEY=sk-…, then ask codex to reply ok. The agent goes through the gateway in chat completions format.

model_provider = "kiree"
model = "gpt-6-astra"

[model_providers.kiree]
name = "kiree"
base_url = "https://kiree.net/v1"
env_key = "OPENAI_API_KEY"
wire_api = "chat"

wire_api = "chat" switches the provider to /v1/chat/completions. The key is read from the OPENAI_API_KEY variable (env_key).

Check: ask codex for a one-word ok — the reply comes from a gateway model; /status shows the kiree provider.

Models

What to connect in Codex CLI

Any text model from the catalog works on one key. Below are popular options to start.

Diagnostics

Common errors

!

401 Unauthorized

OPENAI_API_KEY is missing or wrong: check the export and that the terminal re-read the profile.

!

404 model_not_found

The model ID is not from the kiree catalog: copy the exact ID from the model page, e.g. gpt-6-astra.

!

stream disconnected / responses errors

The provider defaults to the responses wire_api: set wire_api = "chat" in the provider block.

FAQ

Frequently asked questions

How do I connect Codex CLI through the gateway?+

Requests go to kiree.net directly; no OpenAI account or foreign card is needed.

Where is config.toml located?+

Linux/macOS: ~/.codex/config.toml. Windows: %USERPROFILE%\.codex\config.toml.

Do I need an OpenAI subscription?+

No. Usage is billed by tokens from the kiree.net balance.

Which models should I use?+

Any catalog text model: gpt-6-astra, gpt-6-1-sol, gpt-4o-mini and others. The model ID is set in the model field.

Get a key for Codex CLI

Create a key in a couple of minutes; pay only for actual usage, no subscription required.