Skip to main content
Codex uses two files for configuration: config.toml and auth.json. config.toml sets the model and API endpoint. auth.json stores the API key.

1. Open the configuration directory

Press Win + R, enter the following path, and press Enter:
%userprofile%\.codex
If config.toml or auth.json does not exist, create it.

2. Write config.toml

Replace <API_KEY> with your API key, such as sk-xxxxxx. Replace <MODEL> with the model you use, such as qwen3.7-max.
model_provider = "custom"
model = "<MODEL>"
disable_response_storage = true
model_reasoning_effort = "medium"

[model_providers]
[model_providers.custom]
name = "custom"
wire_api = "responses"
requires_openai_auth = true
base_url = "https://www.duiapi.com/v1"

3. Write auth.json

{
  "OPENAI_API_KEY": "<API_KEY>"
}

4. Test the configuration

codex