Codex
Prepare API Access
Have the three items below ready before you configure anything:
API Key
The key string you generated when creating your API key.
Base URL
https://api.watt-cloud.com/v1
The trailing /v1 is required — do not drop it.
Model Name
Take the complete model identifier from the Model Marketplace, for example DeepSeek-V4-Pro.
Installing Codex
Official Codex channels distribute the installer — see Codex CLI.
Linux / macOS / WSL2
curl -fsSL https://chatgpt.com/codex/install.sh | sh
Node.js 22+ users can take the npm route instead:
npm install -g @openai/codex
Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
Connect Codex to Watt Cloud
Requests travel via a custom model provider that you declare in ~/.codex/config.toml, the user-level configuration file of Codex.
Important: the model_provider and model_providers keys are honored only in ~/.codex/config.toml. A project-local .codex/config.toml gets them ignored by Codex.
Previously logged in via ChatGPT? Run the logout first so the two auth methods don't clash:
codex logout
Edit the Configuration File
Open ~/.codex/config.toml — create it if it doesn't exist yet — and add:
model = "GLM-5.1"
model_provider = "watt"
[model_providers.watt]
name = "Watt Cloud"
base_url = "https://api.watt-cloud.com/v1"
env_key = "WATT_API_KEY"
wire_api = "responses"
requires_openai_auth = false
Field Reference
| Field | Description |
|---|---|
model | The model Codex runs by default, e.g. GLM-5.1, DeepSeek-V4-Pro or MiniMax-M2.7 |
model_provider | ID of the provider; it has to match the [model_providers.<id>] block below |
name | Human-readable label shown for this provider |
base_url | The API endpoint — the trailing /v1 is mandatory |
env_key | Environment variable that holds your API key |
wire_api | Which API protocol to speak; choose responses for third-party endpoints |
requires_openai_auth | Leave as false for custom OpenAI-compatible APIs |
Set the API Key
Whichever variable env_key names is where Codex looks for the key, so export it before launching Codex:
export WATT_API_KEY="your-api-key"
To make the setting survive new sessions, drop that export line into the matching shell profile, e.g. ~/.bashrc or ~/.zshrc.
Change the Model
To run a different model, adjust the model value in ~/.codex/config.toml:
model = "DeepSeek-V4-Pro"
Verify the Connection
Once WATT_API_KEY is exported, try:
codex exec -m GLM-5.1 --sandbox read-only "Reply with exactly one word: hello"
Everything is wired up correctly when the output's session header includes provider: watt and the model then answers with pong.
Start Using the Model
From the directory of your project, launch Codex's interactive CLI:
codex