Codex Proxy API Key Integration Guide
This site documents API key usage, code integration, and client configuration for tools such as Codex, Claude Code, and OpenCode.
Recommended
Recommended: use cc-switch for setup: https://github.com/farion1231/cc-switch/releases
Recommended for Codex, Claude Code, and OpenCode. It still writes each tool's official config and environment variables.
1. Get an API Key
- Sign in to the console.
- Redeem a plan or buy credits first. Requests return
402 Insufficient creditsif the account has no active plan or balance. - Open the
API Keyspage and create a key. - Save the plaintext key shown at creation time. It looks like
codex_xxxxxxxxxxxxxxxx.
2. Base URL
https://codex.miaomiaocode.com/v13. Navigation
Code Integration: SDK and HTTP examplesClients / Codex: Codex setup, withcc-switchas the recommended pathClients / OpenClaw: OpenClaw setup, withcc-switchas the recommended pathClients / OpenCode: OpenCode setup, withcc-switchas the recommended pathClients / Claude Code: Claude Code setup, withcc-switchas the recommended path
4. Authentication
Every request uses a standard Bearer token:
http
Authorization: Bearer codex_your_api_key5. Supported Endpoints
| Method | Path | Purpose |
|---|---|---|
GET | /v1/models | List models currently enabled on the gateway |
POST | /v1/chat/completions | OpenAI Chat Completions compatible endpoint |
POST | /v1/responses | OpenAI Responses compatible endpoint, recommended for Codex CLI and newer SDKs |
POST | /v1/embeddings | Embeddings endpoint; defaults to text-embedding-3-small when model is omitted |
POST | /v1/messages | Anthropic Messages compatible endpoint for clients such as Claude Code |
6. Common Errors
| Status | Meaning |
|---|---|
401 | Invalid or disabled API key, or missing Bearer token |
402 | No available credits |
403 | User banned, or the requested model is blocked by plan rules |
429 | Concurrency limit hit, or daily plan quota exhausted |
503 | No active upstream channel, or all channels failed |