Codex

One config.toml connects Codex to UnioAPI

The Codex CLI, desktop app and IDE extensions read the same config file. Add a UnioAPI block, export your key, and all three call GPT models through the Responses API.

~/.codex/config.tomltoml
model = "gpt-6.1-sol"
model_provider = "unioapi"
model_reasoning_effort = "high"

[model_providers.unioapi]
name = "UnioAPI"
base_url = "https://api.unioapi.com/v1"
env_key = "UNIO_API_KEY"
wire_api = "responses"

The key stays out of the file: export UNIO_API_KEY, then start codex.

1 config
Shared by the CLI, desktop app and IDE extensions
Responses
The official API Codex uses
1.05M
Context window on the GPT-6 family
none – max
Adjustable reasoning effort

What you get with Codex on UnioAPI

Native Responses API

Codex only supports the Responses transport. UnioAPI provides POST /v1/responses in the official format, so wire_api = "responses" connects directly.

Three apps, one config

The CLI, desktop app and IDE extensions such as VS Code all read ~/.codex/config.toml — configure once, use everywhere.

Adjustable reasoning

Set model_reasoning_effort within the model's supported range: low effort for small edits, higher for complex refactors.

Fast tier

Most GPT-6 and GPT-5.x models offer Fast; turn it on in Codex and you're billed at Fast prices. Models without Fast return 400 and nothing is executed or charged.

Keys stay off disk

env_key names an environment variable, so the key never appears in the config file. Create a dedicated key for Codex with its own spend cap and expiry.

Per-call usage

Every model call has a request log with model, reasoning effort, tokens, latency and charge; filter by key to see all of Codex's calls.

Set up Codex in four steps

  1. Step 1

    Create an API key

    Create a key for Codex in the console and set a spend cap and expiry if you need them.

    Read the docs
  2. Step 2

    Write config.toml

    Add a [model_providers.unioapi] block with wire_api = "responses", and keep the top-level model_provider equal to the block id.

    Read the docs
  3. Step 3

    Export the key and start

    Export UNIO_API_KEY and run codex; on Windows use setx and open a new terminal.

    Read the docs
  4. Step 4

    Use it in the desktop app

    The desktop app and IDE extensions read the same config; just make sure they can see the environment variable.

    Read the docs

Billed by actual token usage

Every model call Codex makes is settled from its response usage: input, cache reads, cache writes and output are priced separately, reasoning tokens count as output, and each service tier has its own prices. The model pages list current prices.

Codex setup FAQ

No. Since February 2026 Codex only supports the Responses transport and wire_api = "chat" has been removed, so older tutorials no longer work. Use responses.

Further reading

Related topics

Connect Codex to UnioAPI now

Create an API key, write config.toml, export the key and start codex.