### Install Bun on Windows PowerShell Source: https://github.com/alvin0/codex2claudecode/blob/main/CHANGELOG.md Alternative installation command for Windows environments using PowerShell. ```powershell powershell -c "irm bun.sh/install.ps1 | iex" ``` -------------------------------- ### Development Commands for codex2claudecode Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Run these commands in the project root to install dependencies, start the server, run checks, tests, and coverage. The `-- --port 8786` flag overrides the default port for the start command. ```sh bun install bun run start bun run start -- --port 8786 bun run check bun run test bun run coverage ``` -------------------------------- ### Start Server with Password Protection Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Start the server with --password or API_PASSWORD to require authentication. Password comparison uses constant-time comparison to prevent timing attacks. ```sh bunx codex2claudecode --password mysecret # or API_PASSWORD=mysecret bunx codex2claudecode ``` -------------------------------- ### One-liner install to PATH (Linux/macOS) Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Auto-detects OS and architecture and installs the binary to /usr/local/bin. Requires sudo. ```sh curl -fsSL https://github.com/alvin0/codex2claudecode/releases/latest/download/codex2claudecode-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/').tar.gz | sudo tar xz -C /usr/local/bin ``` -------------------------------- ### Install Bun on Unix-like systems Source: https://github.com/alvin0/codex2claudecode/blob/main/CHANGELOG.md Required before upgrading existing Node-only environments to version 0.2.0, which now requires Bun >=1.3.0 at runtime. ```sh curl -fsSL https://bun.sh/install | bash ``` -------------------------------- ### Run installed binary with custom port Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Run the installed binary from anywhere, specifying a custom port with --port. ```sh codex2claudecode-darwin-arm64 --port 8787 ``` -------------------------------- ### Install and run standalone binary on Linux (x64) Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Download and run the standalone binary for Linux x64. No runtime dependencies are required. ```sh curl -fsSL https://github.com/alvin0/codex2claudecode/releases/latest/download/codex2claudecode-linux-x64.tar.gz | tar xz chmod +x codex2claudecode-linux-x64 ./codex2claudecode-linux-x64 ``` -------------------------------- ### Install and run standalone binary on Linux (ARM64) Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Download and run the standalone binary for Linux ARM64. No runtime dependencies are required. ```sh curl -fsSL https://github.com/alvin0/codex2claudecode/releases/latest/download/codex2claudecode-linux-arm64.tar.gz | tar xz chmod +x codex2claudecode-linux-arm64 ./codex2claudecode-linux-arm64 ``` -------------------------------- ### Install and run standalone binary on Windows (x64, PowerShell) Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Download and run the standalone binary for Windows x64 using PowerShell. No runtime dependencies are required. ```powershell Invoke-WebRequest -Uri "https://github.com/alvin0/codex2claudecode/releases/latest/download/codex2claudecode-windows-x64.exe.zip" -OutFile codex2claudecode.zip Expand-Archive codex2claudecode.zip -DestinationPath . .\codex2claudecode-windows-x64.exe ``` -------------------------------- ### Install and run standalone binary on macOS (Intel) Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Download and run the standalone binary for macOS Intel. No runtime dependencies are required. ```sh curl -fsSL https://github.com/alvin0/codex2claudecode/releases/latest/download/codex2claudecode-darwin-x64.tar.gz | tar xz chmod +x codex2claudecode-darwin-x64 ./codex2claudecode-darwin-x64 ``` -------------------------------- ### GET /environments Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Returns environment information. ```APIDOC ## GET /environments ### Description Returns environment information. ### Method GET ### Endpoint /environments ### Response #### Success Response (200) - **environments** (object) - Environment details ``` -------------------------------- ### Use Codex CLI with the gateway Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Set the API key and start Codex sessions. Plain 'codex' uses the real Codex models; 'codex -c model_provider=codex2claude' routes through the gateway with codex2claude- names. Codex binds one provider per session, so you pick the provider when starting the session. ```sh export CODEX2CLAUDECODE_API_KEY=codex2claudecode codex # unchanged: the real Codex models codex -c model_provider=codex2claude # this gateway: codex2claude- ``` -------------------------------- ### GET /v1/models Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Lists available models. ```APIDOC ## GET /v1/models ### Description Lists available models. ### Method GET ### Endpoint /v1/models ### Response #### Success Response (200) - **data** (array) - List of model objects ``` -------------------------------- ### GET / Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Returns server information and configuration, including whether password protection is enabled. ```APIDOC ## GET / ### Description Returns server info and config, including `password_protected` status. ### Method GET ### Endpoint / ### Response #### Success Response (200) - **password_protected** (boolean) - Indicates if password protection is enabled. #### Response Example { "password_protected": true } ``` -------------------------------- ### Run with npm (npx) Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Run codex2claudecode via npx. The launcher checks for Bun, falls back to the npm-published Bun package, and prints install instructions if Bun is missing. ```sh npx codex2claudecode ``` -------------------------------- ### GET /usage Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Returns usage statistics. ```APIDOC ## GET /usage ### Description Returns usage statistics. ### Method GET ### Endpoint /usage ### Response #### Success Response (200) - **usage** (object) - Usage statistics details ``` -------------------------------- ### Install and run standalone binary on macOS (Apple Silicon) Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Download and run the standalone binary for macOS Apple Silicon. No runtime dependencies are required. ```sh curl -fsSL https://github.com/alvin0/codex2claudecode/releases/latest/download/codex2claudecode-darwin-arm64.tar.gz | tar xz chmod +x codex2claudecode-darwin-arm64 ./codex2claudecode-darwin-arm64 ``` -------------------------------- ### Use a custom port Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Start codex2claudecode on a custom port. Both npx and bunx support the --port flag; bunx also supports -p. ```sh npx codex2claudecode --port 8786 ``` ```sh bunx codex2claudecode -p 8786 ``` -------------------------------- ### Setup Codex CLI to use the gateway Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Run this command to append a marked [model_providers.codex2claude] block to ~/.codex/config.toml without changing the default provider. The original file is backed up to config.toml.codex2claudecode.bak, and a second run replaces the block instead of stacking it. ```sh codex2claudecode --setup-codex-cli ``` -------------------------------- ### GET /test-connection Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Connection test endpoint. Does not require authentication. ```APIDOC ## GET /test-connection ### Description Connection test endpoint. Does not require authentication. ### Method GET ### Endpoint /test-connection ### Response #### Success Response (200) - **status** (string) - Connection status ``` -------------------------------- ### List Available Models with curl Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Send a GET request to /v1/models to list available models. Uses X-Api-Key header for authentication. ```sh curl http://127.0.0.1:8787/v1/models \ -H "X-Api-Key: mysecret" ``` -------------------------------- ### View Usage Statistics with curl Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Send a GET request to /usage to view usage statistics. Uses X-Api-Key header for authentication. ```sh curl http://127.0.0.1:8787/usage \ -H "X-Api-Key: mysecret" ``` -------------------------------- ### GET /health Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Health check endpoint. Does not require authentication. ```APIDOC ## GET /health ### Description Health check endpoint. Does not require authentication. ### Method GET ### Endpoint /health ### Response #### Success Response (200) - **status** (string) - Health status ``` -------------------------------- ### Unprotected Endpoints (No Auth Required) Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Endpoints that do not require authentication. GET / returns server info including password_protected: true/false. OPTIONS * is for CORS preflight. ```text GET / Server info (includes password_protected: true/false) GET /health Health check GET /test-connection Connection test OPTIONS * CORS preflight ``` -------------------------------- ### Check Server Info with curl Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Send a GET request to the root endpoint to check server info. Without password protection, omit the -H "X-Api-Key: ..." or -H "Authorization: Bearer ..." headers. ```sh curl http://127.0.0.1:8787/ ``` -------------------------------- ### Health Check with curl Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Send a GET request to the /health endpoint to perform a health check. This endpoint is unprotected and does not require authentication. ```sh curl http://127.0.0.1:8787/health ``` -------------------------------- ### Set Claude Code environment variables on macOS/Linux Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Configure Claude Code to use the codex2claudecode server by setting environment variables. Use in a terminal on macOS or Linux before starting Claude Code. ```sh export ANTHROPIC_BASE_URL="http://127.0.0.1:8787" export ANTHROPIC_API_KEY="codex2claudecode" export ANTHROPIC_AUTH_TOKEN="codex2claudecode" export ANTHROPIC_MODEL="gpt-5.6-sol" export ANTHROPIC_DEFAULT_OPUS_MODEL="gpt-5.6-sol" export ANTHROPIC_DEFAULT_SONNET_MODEL="gpt-5.6-terra" export ANTHROPIC_DEFAULT_HAIKU_MODEL="gpt-5.6-luna" ``` -------------------------------- ### Kiro Connection Options Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md When in Kiro mode, the /connect command offers two options: importing from Kiro IDE auth or manual entry. ```text Add from Kiro IDE auth Manual ``` -------------------------------- ### Run with Bun (bunx) Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Run codex2claudecode directly with Bun using bunx. ```sh bunx codex2claudecode ``` -------------------------------- ### Connect an Account with /connect Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Run /connect in the UI to connect an account using the active provider. For Codex, you can choose between importing from ~/.codex/auth.json or manual entry. ```text /connect ``` -------------------------------- ### Codex Connection Options Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md When using Codex, the /connect command presents two options: importing from the Codex CLI auth file or manual entry. ```text Add from ~/.codex/auth.json Manual ``` -------------------------------- ### Live Smoke Test with auth-codex.json Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Run a live smoke test using the `auth-codex.json` file. This command is intended for testing against a live environment. ```sh bun run test:live ``` -------------------------------- ### Kiro Auth Token Cache Files Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Kiro IDE auth imports from these token cache files. Both are imported when present, with the desktop cache taking priority, or a single file is read from KIRO_AUTH_FILE if set. ```text ~/.aws/sso/cache/kiro-auth-token.json ~/.aws/sso/cache/kiro-auth-token-cli.json ``` -------------------------------- ### Switch provider with /switch-provider command Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Use the /switch-provider command in the terminal UI to switch between Codex and Kiro providers. The active provider is shown in the title bar, and switching restarts the runtime with the new provider's credentials. ```text /switch-provider ``` -------------------------------- ### Account Rotation Failure Handling Rules Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Lists the account-level failure codes that trigger rotation, the reason for each, and the cooldown duration. Any other error is returned as-is without rotating. ```text 401 / 403 auth is dead rests 30 min 402 / 429 quota exhausted rests until the provider's reset time 5xx upstream is broken rests 1 min ``` -------------------------------- ### Rename binary and run with custom port Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Rename the binary to codex2claudecode for convenience, then run it with a custom port. ```sh sudo mv /usr/local/bin/codex2claudecode-* /usr/local/bin/codex2claudecode codex2claudecode --port 8787 ``` -------------------------------- ### POST /v1/chat/completions Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md OpenAI Chat Completions API endpoint. Supports both streaming and non-streaming requests. ```APIDOC ## POST /v1/chat/completions ### Description OpenAI Chat Completions API endpoint. Supports both streaming and non-streaming requests. ### Method POST ### Endpoint /v1/chat/completions ### Parameters #### Request Body - **model** (string) - Required - Model identifier - **messages** (array) - Required - List of message objects with `role` and `content` - **stream** (boolean) - Optional - Whether to stream the response - **response_format** (object) - Optional - Formatting options for the response ### Request Example { "model": "gpt-5.4", "stream": true, "messages": [{"role": "user", "content": "Hello"}] } ### Response #### Success Response (200) - **id** (string) - Response ID - **object** (string) - Object type - **created** (integer) - Creation timestamp - **model** (string) - Model used - **choices** (array) - List of completion choices ``` -------------------------------- ### Authentication Headers for Protected Endpoints Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Protected endpoints require one of these headers: X-Api-Key: mysecret or Authorization: Bearer mysecret. ```text X-Api-Key: mysecret Authorization: Bearer mysecret ``` -------------------------------- ### Manual Kiro Connection Fields Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Manual mode for Kiro asks for these fields: label, accessToken, refreshToken, region, profileArn. label and profileArn are optional. ```text label accessToken refreshToken region profileArn ``` -------------------------------- ### Rotation Screen Pool Display Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Shows the /rotation screen with the current state, on/off options, and the account pool with statuses and usage details. ```text Account rotation Current: on · active work@example.com > on Retry on the next account when one fails off Fail the request on the active account ── Accounts ── work@example.com active 55% used · resets 03:02 PM personal@example.com resting quota (429) · resets 03:32 PM · 100% used old@example.com ready 12% used ``` -------------------------------- ### Protect API with password (environment variable) Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Set a password via the API_PASSWORD environment variable. When set, all API endpoints except /, /health, /test-connection, and OPTIONS require authentication via X-Api-Key or Authorization: Bearer header. ```sh API_PASSWORD=mysecret bunx codex2claudecode ``` -------------------------------- ### POST /v1/responses Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md OpenAI Responses API endpoint. Supports both streaming and non-streaming requests. ```APIDOC ## POST /v1/responses ### Description OpenAI Responses API endpoint. Supports both streaming and non-streaming requests. ### Method POST ### Endpoint /v1/responses ### Parameters #### Request Body - **model** (string) - Required - Model identifier - **input** (string) - Required - Input text - **stream** (boolean) - Optional - Whether to stream the response - **text.format** (object) - Optional - Formatting options for the response text ### Request Example { "model": "gpt-5.4", "input": "Hello" } ### Response #### Success Response (200) - **id** (string) - Response ID - **object** (string) - Object type - **created** (integer) - Creation timestamp - **model** (string) - Model used - **output** (array) - Response output ``` -------------------------------- ### Send OpenAI Chat Completions Request Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Send a streaming OpenAI Chat Completions request to /v1/chat/completions. Uses Authorization: Bearer header for authentication. The request includes model, stream: true, and messages. ```sh curl http://127.0.0.1:8787/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer mysecret" \ -d '{ "model": "gpt-5.4", "stream": true, "messages": [{"role": "user", "content": "Hello"}] }' ``` -------------------------------- ### Protect API with password (flag) Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Set a password via the --password flag. When set, all API endpoints except /, /health, /test-connection, and OPTIONS require authentication via X-Api-Key or Authorization: Bearer header. ```sh bunx codex2claudecode --password mysecret ``` -------------------------------- ### Supported Local API Endpoints Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md List of endpoints supported by the local API. Both Claude and OpenAI-compatible endpoints support streaming (stream: true) and non-streaming (stream: false) requests. Non-streaming requests accumulate the full response before returning a single JSON body. ```text GET / Server info and config POST /v1/messages Claude Messages API POST /v1/messages/count_tokens Token counting POST /v1/responses OpenAI Responses API POST /v1/chat/completions OpenAI Chat Completions API GET /v1/models Model listing GET /usage Usage statistics GET /environments Environment info GET /health Health check GET /test-connection Connection test ``` -------------------------------- ### Rotation Status with Single Account Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Shows the dashboard display when rotation is on but only one account is connected, indicating it is idle until a second account is added. ```text Rotation: ON · 1 account Idle until a second account is connected ``` -------------------------------- ### Rotation Status with Multiple Accounts Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Displays the dashboard pool when two or more accounts are connected, showing each account's status, usage, and reset time. ```text Rotation ON · 3 accounts · 1 resting › work@example.com active 55% used · resets 03:02 PM personal@example.com resting quota (429) · resets 03:32 PM · 100% used old@example.com ready 12% used ``` -------------------------------- ### Managed Kiro Accounts Storage Path Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Managed Kiro accounts are stored in this file. ```text ~/.codex2claudecode/kiro-state.json ``` -------------------------------- ### Manual Codex Connection Fields Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Manual mode for Codex asks for these fields: accountId, accessToken, refreshToken. The refresh token is used to fetch a fresh access token before saving. ```text accountId accessToken refreshToken ``` -------------------------------- ### Override Kiro payload size limit with KIRO_PAYLOAD_SIZE_LIMIT_BYTES or KIRO_MAX_PAYLOAD_SIZE_MB Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Set either environment variable to override the default Kiro payload limit of 1_200_000 bytes. When a request exceeds the limit, the gateway trims oldest history and emits a warning for non-Claude clients. For Claude Code requests, a context-window error is returned instead of trimming. ```sh KIRO_PAYLOAD_SIZE_LIMIT_BYTES=900000 ``` ```sh KIRO_MAX_PAYLOAD_SIZE_MB=1.2 ``` -------------------------------- ### Environment Variables for Rotation Control Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Environment variables to override the stored rotation toggle and set the default quota cooldown. ACCOUNT_ROTATION forces rotation on or off; ACCOUNT_ROTATION_COOLDOWN_MINUTES sets the cooldown duration. ```sh ACCOUNT_ROTATION=1 # force on ACCOUNT_ROTATION=0 # force off ACCOUNT_ROTATION_COOLDOWN_MINUTES=30 # default quota cooldown ``` -------------------------------- ### Choose model name prefix with CODEX_MODEL_PREFIX Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Set CODEX_MODEL_PREFIX to control how models are named in the picker. Default is '1' (codex2claude- prefix), '0' uses upstream names, and 'both' lists every model twice. 'both' is presentation only; all traffic still goes through the gateway. ```sh CODEX_MODEL_PREFIX=1 # default — codex2claude-gpt-5.6-sol CODEX_MODEL_PREFIX=0 # the upstream's own names — gpt-5.6-sol CODEX_MODEL_PREFIX=both # every model listed twice, under both names ``` -------------------------------- ### Expected Shape of ~/.codex/auth.json Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md The auth file imported from ~/.codex/auth.json must have this JSON structure with auth_mode and tokens fields. ```json { "auth_mode": "chatgpt", "tokens": { "access_token": "...", "refresh_token": "...", "account_id": "..." } } ``` -------------------------------- ### Enable Codex WebSocket transport with CODEX_WIRE_API Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Set the environment variable to enable the WebSocket transport for the Responses API. The transport is off by default because the endpoint is still beta. Only streaming requests use the WebSocket; non-streaming requests and failed handshakes fall back to HTTPS. ```sh CODEX_WIRE_API=responses_websocket ``` -------------------------------- ### Claude environment config JSON for extraEnv and unsetEnv Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Stored as .claude-env.json next to the auth file. extraEnv adds or updates keys in ~/.claude/settings.json -> env; unsetEnv removes listed keys during /set-claude-env. Both lists are also included in /unset-claude-env. ```json { "extraEnv": { "CUSTOM_ENV": "custom-value" }, "unsetEnv": ["HTTP_PROXY"] } ``` -------------------------------- ### UI Commands for codex2claudecode Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md List of slash commands available in the codex2claudecode UI. /set-claude-env writes managed keys into ~/.claude/settings.json under the env object, updating existing values and preserving unrelated content. /unset-claude-env asks for confirmation, then removes only the managed keys from that env object. ```text /connect Add or update an account for the active provider /switch-provider Switch between Codex and Kiro providers /account Switch active provider account /limits Show active provider account limits /logs Show recent runtime request logs /set-claude-env Edit Claude Code environment exports /unset-claude-env Remove Claude Code environment variables /quit Quit codex2claudecode ``` -------------------------------- ### GPT-5 model names with reasoning effort suffixes Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md GPT-5 model names can include a suffix for reasoning effort. Suffixes map to the OpenAI Responses reasoning.effort field. If no suffix is supplied, medium is used; ultra is sent as max. ```text gpt-5.4 gpt-5.4_high gpt-5.4_xhigh gpt-5.4-mini_low gpt-5.6-sol_max gpt-5.6-sol_ultra ``` -------------------------------- ### Send OpenAI Responses Request Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Send an OpenAI Responses request to /v1/responses. Uses Authorization: Bearer header for authentication. The request includes model and input. ```sh curl http://127.0.0.1:8787/v1/responses \ -H "Content-Type: application/json" \ -H "Authorization: Bearer mysecret" \ -d '{ "model": "gpt-5.4", "input": "Hello" }' ``` -------------------------------- ### Default Local API Server Address Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md The default server address for the local API. The server runs at http://127.0.0.1:8787. ```text http://127.0.0.1:8787 ``` -------------------------------- ### Reasoning effort suffix values Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Valid suffixes for GPT-5 models, mapped to the OpenAI Responses reasoning.effort field. The default is medium when no suffix is supplied. ```text none, low, medium (default), high, xhigh, max, ultra ``` -------------------------------- ### Set Claude Code environment variables in PowerShell Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Configure Claude Code to use the codex2claudecode server by setting environment variables. Use in PowerShell on Windows. ```powershell $env:ANTHROPIC_BASE_URL="http://127.0.0.1:8787" $env:ANTHROPIC_API_KEY="codex2claudecode" $env:ANTHROPIC_AUTH_TOKEN="codex2claudecode" $env:ANTHROPIC_MODEL="gpt-5.6-sol" $env:ANTHROPIC_DEFAULT_OPUS_MODEL="gpt-5.6-sol" $env:ANTHROPIC_DEFAULT_SONNET_MODEL="gpt-5.6-terra" $env:ANTHROPIC_DEFAULT_HAIKU_MODEL="gpt-5.6-luna" ``` -------------------------------- ### POST /v1/messages Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Claude Messages API endpoint. Supports both streaming and non-streaming requests. ```APIDOC ## POST /v1/messages ### Description Claude Messages API endpoint. Supports both streaming and non-streaming requests. ### Method POST ### Endpoint /v1/messages ### Parameters #### Request Body - **model** (string) - Required - Model identifier (e.g., "gpt-5.4") - **max_tokens** (integer) - Required - Maximum tokens to generate - **stream** (boolean) - Required - Whether to stream the response - **messages** (array) - Required - List of message objects with `role` and `content` ### Request Example { "model": "gpt-5.4", "max_tokens": 1024, "stream": true, "messages": [{"role": "user", "content": "Hello"}] } ### Response #### Success Response (200) - **content** (array) - Generated message content - **role** (string) - Role of the response - **model** (string) - Model used - **stop_reason** (string) - Reason for stopping - **usage** (object) - Token usage details ``` -------------------------------- ### POST /v1/messages/count_tokens Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Token counting endpoint for the Claude Messages API. ```APIDOC ## POST /v1/messages/count_tokens ### Description Token counting endpoint for the Claude Messages API. ### Method POST ### Endpoint /v1/messages/count_tokens ### Parameters #### Request Body - **model** (string) - Required - Model identifier - **messages** (array) - Required - List of messages to count tokens for ### Request Example { "model": "gpt-5.4", "messages": [{"role": "user", "content": "Hello"}] } ### Response #### Success Response (200) - **input_tokens** (integer) - Number of input tokens ``` -------------------------------- ### Claude Code UI command to edit model values Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Run this command inside Claude Code to edit the four default model values and preview the changes to ~/.claude/settings.json. ANTHROPIC_BASE_URL is always generated from the active host/port. ```text /set-claude-env ``` -------------------------------- ### Send Claude Messages Request (Streaming) Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Send a streaming Claude Messages request to /v1/messages. Uses X-Api-Key header for authentication. The request includes model, max_tokens, stream: true, and messages. ```sh curl http://127.0.0.1:8787/v1/messages \ -H "Content-Type: application/json" \ -H "X-Api-Key: mysecret" \ -d '{ "model": "gpt-5.4", "max_tokens": 1024, "stream": true, "messages": [{"role": "user", "content": "Hello"}] }' ``` -------------------------------- ### Codex model picker names Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md These are the model names Codex offers in its picker, prefixed with 'codex2claude-' to indicate traffic goes through the gateway. The catalog is fetched from the gateway and renamed; no model is pinned. ```text codex2claude-gpt-5.6-sol codex2claude-gpt-5.6-terra codex2claude-claude-opus-5 ``` -------------------------------- ### Send Claude Messages Request (Non-Streaming) Source: https://github.com/alvin0/codex2claudecode/blob/main/README.md Send a non-streaming Claude Messages request to /v1/messages. Uses X-Api-Key header for authentication. The request includes model, max_tokens, stream: false, and messages. ```sh curl http://127.0.0.1:8787/v1/messages \ -H "Content-Type: application/json" \ -H "X-Api-Key: mysecret" \ -d '{ "model": "gpt-5.4", "max_tokens": 1024, "stream": false, "messages": [{"role": "user", "content": "Hello"}] }' ```