Skip to content

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

  1. Sign in to the console.
  2. Redeem a plan or buy credits first. Requests return 402 Insufficient credits if the account has no active plan or balance.
  3. Open the API Keys page and create a key.
  4. Save the plaintext key shown at creation time. It looks like codex_xxxxxxxxxxxxxxxx.

2. Base URL

https://codex.miaomiaocode.com/v1

3. Navigation

  • Code Integration: SDK and HTTP examples
  • Clients / Codex: Codex setup, with cc-switch as the recommended path
  • Clients / OpenClaw: OpenClaw setup, with cc-switch as the recommended path
  • Clients / OpenCode: OpenCode setup, with cc-switch as the recommended path
  • Clients / Claude Code: Claude Code setup, with cc-switch as the recommended path

4. Authentication

Every request uses a standard Bearer token:

http
Authorization: Bearer codex_your_api_key

5. Supported Endpoints

MethodPathPurpose
GET/v1/modelsList models currently enabled on the gateway
POST/v1/chat/completionsOpenAI Chat Completions compatible endpoint
POST/v1/responsesOpenAI Responses compatible endpoint, recommended for Codex CLI and newer SDKs
POST/v1/embeddingsEmbeddings endpoint; defaults to text-embedding-3-small when model is omitted
POST/v1/messagesAnthropic Messages compatible endpoint for clients such as Claude Code

6. Common Errors

StatusMeaning
401Invalid or disabled API key, or missing Bearer token
402No available credits
403User banned, or the requested model is blocked by plan rules
429Concurrency limit hit, or daily plan quota exhausted
503No active upstream channel, or all channels failed

OpenAI-compatible gateway integration docs