Codex CLI

Set a custom base URL for the OpenAI Codex CLI.

Codex CLI reads custom model providers from config.toml. Aiduct exposes the Responses protocol at /v1/responses, so Codex can run through your Aiduct balance.

CODEX CLI CONFIG
# ~/.codex/config.toml
model = "gpt-4o-mini"
model_provider = "aiduct"

[model_providers.aiduct]
name = "Aiduct"
base_url = "https://api.aiduct.ai/v1"
env_key = "AIDUCT_API_KEY"
wire_api = "responses"

# Shell
export AIDUCT_API_KEY=sk-aiduct-...
codex "summarize this repository"

CONFIG

config.toml

PROTOCOL

Responses

ENDPOINT

/v1/responses

Why Codex uses /v1

Unlike Claude Code, Codex expects an OpenAI-style base URL. Use the /v1 suffix so the CLI can call Responses and model endpoints correctly.

Run Codex without a ChatGPT subscription

Aiduct lets you meter Codex calls through an API balance. This is useful for occasional coding work, CI helpers, and agent experiments.

FAQ

What OPENAI_BASE_URL should Codex use?+

Use https://api.aiduct.ai/v1.

Does Codex use the Responses API?+

Yes. Aiduct supports the OpenAI Responses-compatible route used by Codex CLI.

Can Codex use Claude through Aiduct?+

Yes. Aiduct serves every catalog chat model on the Responses path that Codex uses, translating tool calls and reasoning for models that do not speak it natively. Set model to the catalog id.