Codex gateway · live

Run Codex through SoleAPI by changing one base URL

SoleAPI natively supports the OpenAI Responses protocol Codex uses — including the /v1/responses/compact and input_tokens endpoints Codex calls. 6 OpenAI models, automatic failover on rate limits and 5xx. Alipay top-ups, pay as you go, no monthly fee.

7-day uptime 99.4%First frame forwarded · no buffering6 OpenAI modelsUp to 95% below list price
# ~/.zshrc / ~/.bashrc
export OPENAI_BASE_URL="https://api.soleapi.com/v1"
export OPENAI_API_KEY="sk-sole-..."

codex --model gpt-6-astra
✔ Connected to api.soleapi.com/v1 · model gpt-6-astra · wire_api responses

Why a gateway instead of the official endpoint

Not a replacement for OpenAI — a layer on top: reliability, payment and billing, three things the vendor does not solve for you.

Automatic failover on 5xx / rate limits

Each model has several upstream channels. When OpenAI returns 500, overloaded or rate-limited, the gateway switches to a backup before the first frame, so Codex never sees the error.

Alipay top-ups, pay as you go

No overseas card, no subscription. 1 Credit = ¥1, billed per use; spend is split per model and per key in the console.

Native protocol, zero-buffer streaming

OpenAI Responses passes straight through with no translation; every SSE frame is forwarded as it arrives, so Codex streams exactly like a direct connection.

Connect Codex in three steps

Three steps, no changes to Codex itself.

STEP 01

Sign up for free credits

Register with an email and receive trial Credits — enough to wire up a real project.

STEP 02

Create an API key

Console → API Keys → New. Give the key a budget, restrict models or channels if you like.

STEP 03

Point at SoleAPI and start Codex

Swap the base URL for SoleAPI and the key for the one you just created; everything else stays.

# ~/.zshrc / ~/.bashrc
export OPENAI_BASE_URL="https://api.soleapi.com/v1"
export OPENAI_API_KEY="sk-sole-..."

codex --model gpt-6-astra

Models and pricing for Codex

SoleAPI default channel price in Credits (1 Credit = ¥1); struck-through is the list price. Click a model for full pricing, protocols and uptime.

ModelContextInput (prompt) / MOutput (completion) / M7-day uptime
GPT-5.6 Lunagpt-5.6-luna1.05M$0.20.0695% off$1.200.3698.7%
GPT-5.6 Terragpt-5.6-terra1.05M$2.000.695% off$12.003.699.5%
GPT-5.5gpt-5.51.05M$5.001.595% off$30.009
GPT-5.6 Solgpt-5.6-sol1.05M$5.001.595% off$30.00999.5%
GPT-Image-2gpt-image-2$5.001.595% off
GPT-6 Astragpt-6-astra1.05M$10.00395% off$50.0015100.0%

Same data as the model catalog, refreshed every 5 minutes. All 6 OpenAI models

Common Codex errors and how the gateway handles them

These errors come from the official OpenAI API. Through SoleAPI the gateway retries and fails over before the first frame, so Codex usually never shows them.

stream disconnected before completion

Stream closed before completion

The official side closed the connection or stopped sending frames. SoleAPI: a disconnect before the first frame is retried on another channel; every upstream frame is forwarded as it arrives, unbuffered.

429 Too Many Requests

Official rate limit

One account ran out of RPM / TPM, or the Codex plan quota is exhausted. SoleAPI: several upstream keys share the quota; when one returns 429 the next takes over.

insufficient_quota

Official quota exhausted

The OpenAI account balance or plan quota is zero. SoleAPI: your balance lives on SoleAPI and tops up via Alipay any time; you get an email before it runs out.

401 Incorrect API key provided

Key does not match the base URL

The base URL points at SoleAPI but the key is still the official one, or vice versa. SoleAPI: base URL and key come as a pair — api.soleapi.com/v1 goes with a key starting with sk-sole-.

FAQ

Is a Codex gateway safe? Can anyone see my code?

Keys, emails and other sensitive strings are masked before forwarding; transport is encrypted end to end; your requests are never used to train any model. Keys can be limited to models and budgets and revoked in one click.

How is this different from calling OpenAI directly?

Same protocol (Responses passed through natively, including compact and input_tokens), same models, plus three things: automatic failover when the official API fails, Alipay top-ups with CNY billing, and per-key usage and budget control.

Does it work with Claude Code and Gemini CLI too?

Yes. Anthropic Messages and Gemini generateContent are supported as well — point each tool at the SoleAPI base URL. All tools share one API key and one balance.

How do I top up, and is there a minimum?

Console → Wallet, Alipay accepted; 1 Credit = ¥1, billed per use, no monthly fee or minimum. You get an email before the balance runs out.

One base URL change and Codex runs reliably

Free credits on sign-up, pay as you go, no monthly fee.

Get an API Key