Skip to content

Codex

Codex should use the OpenAI Responses protocol against CoAIWork.

Quick Reference

Item Value
Base URL https://coaiwork.com/v1
Request path relative to Base URL /responses
wire_api responses
Environment variable COAIWORK_API_KEY
Environment Codex config path
macOS ~/.codex/config.toml
Linux ~/.codex/config.toml
Windows $HOME\.codex\config.toml

Because the base URL already includes /v1, Codex requests /responses. The full URL is https://coaiwork.com/v1/responses.

Warning

COAIWORK_API_KEY must be set as an environment variable. Do not hard-code the real token in config.toml. env_key = "COAIWORK_API_KEY" only tells Codex which environment variable name to read.

Recommended ~/.codex/config.toml:

model_provider = "coaiwork"
model = "gpt-5.4"

[model_providers.coaiwork]
name = "CoAIWork"
base_url = "https://coaiwork.com/v1"
env_key = "COAIWORK_API_KEY"
wire_api = "responses"

macOS

1. Install

npm install -g @openai/codex

2. Set the environment variable

echo 'export COAIWORK_API_KEY="<YOUR_TOKEN>"' >> ~/.zshrc
source ~/.zshrc

3. Write the configuration

mkdir -p ~/.codex

Save the configuration above to ~/.codex/config.toml.

4. Verify

curl -s https://coaiwork.com/v1/responses \
  -H "Authorization: Bearer $COAIWORK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4",
    "input": "Reply with OK only."
  }'

5. Run

codex

Linux

1. Install

npm install -g @openai/codex

2. Set the environment variable

echo 'export COAIWORK_API_KEY="<YOUR_TOKEN>"' >> ~/.bashrc
source ~/.bashrc

3. Write the configuration

mkdir -p ~/.codex

Save the configuration above to ~/.codex/config.toml, then run:

codex exec "Reply with exactly OK."

Windows

1. Install

npm install -g @openai/codex

2. Set the environment variable

[Environment]::SetEnvironmentVariable("COAIWORK_API_KEY", "<YOUR_TOKEN>", "User")

3. Write the configuration

New-Item -ItemType Directory -Force $HOME\.codex | Out-Null

Save the same configuration to $HOME\.codex\config.toml, then run:

codex