← All applications · Connect apps section on /docs
Codex CLI
Also known as: codex · OpenAI Codex CLI
Codex CLI: configure the API key, model and provider in your terminal.
Published instructions · Checked version: 0.163.0-alpha.10.2 · Checked on:
The real application was run against a local mock API to check connection settings, authentication and streaming responses. Production, all features, plugins and operating systems have not been verified.
Chat, ping, invoke and content-generation examples may send real billable requests. Check the model, balance, rate and minimum before running them. GET /v1/models checks authentication and the catalogue only. Set up environment variables safely
Base URL to paste
OpenAI SDKs generally use a URL ending in /v1; Anthropic SDKs use the root URL. Avoid adding /v1 twice. Protocol compatibility does not guarantee every provider feature.
https://thapi.cloud/v1Prerequisites
- `codex` is installed
- API key ThAPI
- STALI_API_KEY environment variable (recommended)
Recommended model: gpt-5.6-sol
Quick way — command / config
npm install -g API CLI@latest
api-cli configure codex -m gpt-5.6-sol
export STALI_API_KEY='sk-thapi-...'
codexWhere to place file / fill Settings
Use the content from the config.toml snippet. Make sure base_url includes /v1.
Same as macOS.
Create the `.codex` directory if missing; paste the TOML; run setx STALI_API_KEY.
Verify connection
- `codex` runs and returns a short response.
- Dashboard → Usage.
Troubleshooting
| Symptom | Reason | How to handle |
|---|---|---|
| 404 | base_url is missing /v1. | base_url = "https://thapi.cloud/v1" |
| Missing API key | env_key STALI_API_KEY has not been exported. | export/setx STALI_API_KEY, then open a new terminal. |
Notes
- Codex App (GUI) usually shares ~/.codex — see the codex-app page.