Skip to content

Configure Codex

Codex uses the OpenAI protocol, so you need to point the API address to this site's OpenAI-compatible endpoint.

Option 1: Environment variables (simplest, general-purpose)

bash
export OPENAI_BASE_URL="https://kuaiapi.net/v1"
export OPENAI_API_KEY="sk-your-key"

Then just use Codex CLI as usual.

Edit ~/.codex/config.toml:

toml
model_provider = "kuai"

[model_providers.kuai]
name = "KuaiAPI"
base_url = "https://kuaiapi.net/v1"
env_key = "KUAIAPI_API_KEY"
wire_api = "responses"

And set it in your shell:

bash
export KUAIAPI_API_KEY="sk-your-key"

Option 3: VS Code extension

  1. Install the Codex extension
  2. In the extension settings, select or add a custom Provider
  3. For Base URL, enter https://kuaiapi.net/v1; for API Key, enter your key
  4. Pick a model and start chatting

Verify

bash
codex exec "hello"

A normal response means it worked. If you get an error, check Troubleshooting.

TIP

  • The recommended configuration page (Use Key) automatically generates Codex configuration that fits your current group; prefer this one
  • Model names should follow the model list of your group

Troubleshooting: tool calls return 400 (parallel_tool_calls)

Symptom: Codex chats fine, but as soon as it needs to call a tool (running a command, writing a file, etc.) it returns 400, with an error message like:

X-OpenAI-Internal-Codex-Responses-Lite requires `parallel_tool_calls` to be false.

Cause: Newer versions of Codex use the Responses Lite protocol mode for models such as GPT-5.6. That mode specifies "single tool call", and parallel_tool_calls must be explicitly false in the request. Some Codex versions (especially alpha previews, or when the "enable parallel tool calls for all model prompts" option is on) send parallel_tool_calls: true (or omit the field), and the platform gateway rejects the request per the protocol, returning the 400 above.

Steps to resolve (try them in order):

  1. In Codex settings, turn off "parallel tool calls" (Enable parallel tool calls for all model prompts), then restart Codex;
  2. If it still fails, switch to the Codex stable release (not the alpha/preview channel); the stable release already sends compliant requests under the Lite protocol by default;
  3. If none of the above works, contact support (support@kuaiapi.net) with your codex-tui version number, and we'll help you sort it out.

Note: this is an adaptation issue between the new Codex protocol and the platform gateway. We've reported it to the gateway maintainers and are following up on automatic compatibility, so no manual configuration will be needed after a future version upgrade.

Ready to get started?

Sign up and get $0.30 in trial credit; usage is billed per token in real time, so you pay only for what you use.

Sign up freeSee model pricing

For lawful and compliant use only. Please follow our Terms of Service and your local laws and regulations.