Codex CLI

Set a custom base URL for the OpenAI Codex CLI.

Codex CLI uses OpenAI-compatible environment variables. Aiduct exposes the Responses protocol at /v1/responses, so Codex can run through your Aiduct balance.

CODEX CLI ENV
export OPENAI_BASE_URL=https://api.aiduct.ai/v1
export OPENAI_API_KEY=sk-aiduct-...

codex --model gpt-4o-mini "summarize this repository"

ENV VAR

OPENAI_BASE_URL

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?+

For Codex CLI, use models exposed through the OpenAI-compatible Responses path. Claude Code should use the Anthropic Messages path.