Jump straight to the numbers

← All articles

Codex CLI via CheapRelay API proxy: $0.8861 per 1M tokens

01 / When Codex CLI and CheapRelay are a practical match

Codex CLI is an OpenAI-compatible client, and that puts it squarely within CheapRelay’s supported path for GPT models. The API base is https://api.cheapapirelay.com, with OpenAI-compatible models served under /v1. In a config file, you point Codex at that endpoint, select a listed model id, and provide your CheapRelay key. There is no monthly fee: you add prepaid funds, and the balance does not expire.

The arithmetic is attractive when your work produces a meaningful stream of input and output tokens. For example, one million input tokens plus one million output tokens on GPT-6.1 Sol costs $0.1486 + $0.7375 = $0.8861. The official list prices for that same token volume are $2.00 + $10.00 = $12.00. The example saves $12.00 − $0.8861 = $11.1139, or about 92.6%.

That example does not mean every Codex user needs CheapRelay. If an existing subscription already covers the usage, staying put may be simpler. If you specifically need Claude models, Codex CLI is the wrong client: Claude models on CheapRelay work only with the official Claude Code and Claude Desktop clients, version 2.1.285 or newer. Gemini is also separate, using its native protocol under /v1beta through Gemini CLI.

02 / The config file: three values to get right

For a Codex setup, keep the configuration small. First, set the API base to the CheapRelay OpenAI-compatible endpoint at https://api.cheapapirelay.com/v1. Secondly, enter the model id exactly as it appears in the price list. Thirdly, add the key associated with your account.

For this example, use GPT-6.1 Sol and enter gpt-6.1-sol. Other listed GPT ids include gpt-5.6-sol and gpt-6-astra. The same /v1 route can also serve OpenAI-compatible models such as DeepSeek V4 Flash with deepseek-v4-flash, Qwen3.7 Plus with qwen3.7-plus, and MiniMax M3 with MiniMax-M3.

Do not copy an OpenAI-compatible configuration into Claude Code. Claude models on CheapRelay are not served through that route, and they are not usable through Cursor, Cherry Studio, Cline, Roo Code, OpenCode, an SDK, or cURL. For Gemini, do not use an OpenAI-compatible base either: Gemini models require the native protocol under /v1beta through Gemini CLI.

The account also starts with $0.09 in sign-up credit, usable on any model. That credit is enough to make a small test call before you decide how much to add. If a request returns HTTP 402, the balance is at or below zero; top up the prepaid balance and retry. CheapRelay bills by real token use, so a short test gives you a direct first measurement instead of a vague estimate.

03 / Your first bill, shown as token arithmetic

Here is a smaller example for a first session. Suppose Codex sends 100,000 input tokens, receives 50,000 output tokens, and reads 200,000 cached tokens on GPT-6.1 Sol. The price list shows $0.1486 per million input tokens, $0.7375 per million output tokens, and $0.0347 per million cache-read tokens.

The example bill works out like this:

  • ■ Input: 100,000 ÷ 1,000,000 × $0.1486 = $0.01486.
  • ■ Output: 50,000 ÷ 1,000,000 × $0.7375 = $0.036875.
  • ■ Cache reads: 200,000 ÷ 1,000,000 × $0.0347 = $0.00694.
  • ■ Total: $0.01486 + $0.036875 + $0.00694 = $0.058675.

The $0.09 sign-up credit exceeds that example cost by $0.09 − $0.058675 = $0.031325. You can use the remainder on another model because the credit works across the price list. If the session grows, the same method produces the next bill: multiply each token count by its per-million rate, then add the three lines.

For a larger comparison, one million input tokens and one million output tokens on GPT-5.6 Sol cost $0.3056 + $1.71 = $2.0156. The official list total is $4.00 + $20.00 = $24.00. The example difference is $24.00 − $2.0156 = $21.9844, or about 91.6%.

GPT-6 Astra costs $0.5639 per million input tokens and $2.82 per million output tokens. For one million of each, the example total is $3.3839. The official list total is $10.00 + $50.00 = $60.00, so the difference is $56.6161, or about 94.4%.

04 / Choosing a model by the numbers, not the label

Start with the shape of your workload. GPT-6.1 Sol has a lower input rate than GPT-5.6 Sol: $0.1486 versus $0.3056 per million. Its output rate is also lower, at $0.7375 versus $1.71. For an example with one million input and one million output tokens, GPT-6.1 Sol costs $0.8861 while GPT-5.6 Sol costs $2.0156, a difference of $1.1295 in GPT-6.1 Sol’s favor.

Cache reads can change the ranking in a code-heavy session. GPT-6.1 Sol charges $0.0347 per million cache-read tokens, compared with $0.0264 for GPT-5.6 Sol. For one million cached tokens, the example difference is $0.0083. That saving is smaller than the output-token difference above, but it still belongs in the calculation.

You are not limited to GPT models in the wider CheapRelay price list. Qwen3.7 Plus charges $0.1208 per million input tokens, $0.3625 per million output tokens, and $0.0361 per million cache reads. MiMo V2.6 Pro charges $0.1736, $0.3472, and $0.002778 respectively. For one million tokens in each category, MiMo V2.6 Pro costs $0.0012 more on input, $0.0153 less on output, and $0.033322 less on cache reads than Qwen3.7 Plus. The totals are $0.5194 for Qwen3.7 Plus and $0.523578 for MiMo V2.6 Pro in that example.

Claude deserves a separate decision. Claude Haiku 4.5 lists $0.2917 per million input tokens and $1.40 per million output tokens. The official list prices are $1.00 and $5.00, so its output price is 72% under list. But that saving applies when you use the supported official Claude Code or Claude Desktop client, not Codex CLI.

05 / Limits, balance safety, and the operational details

CheapRelay allows 120 calls per minute per key and eight calls at once per account. Those limits make it possible to reason about concurrency without guessing. If your Codex workflow stays within them, the remaining variables are model choice and token volume.

The refund policy also deserves a line in your calculation. Unused balance can be refunded within 12 days of the top-up, minus what was spent and the payment fee. That makes a small opening top-up a practical way to test the configuration before committing more funds. The prepaid balance does not expire, and there is no monthly fee.

Referral rewards can also reduce the effective cost of a larger experiment. A directly invited user contributes 20% of what they pay, and the second level contributes 6%. Those amounts enter a withdrawable rewards balance, with the smallest withdrawal at ¥20 through Alipay. Treat this as a separate reward calculation rather than spending it against your API balance.

06 / When to switch, and when to stay put

CheapRelay fits when you want Codex CLI to use a prepaid, pay-as-you-go API balance, you are comfortable entering a base URL and model id, and token-based pricing gives you a clear cost ceiling. The example first bill is $0.058675, and every larger estimate follows the same multiplication-and-addition process. You can begin with the $0.09 credit, inspect the actual token use, and decide whether the observed total justifies a larger top-up.

Stay with your current setup when an existing subscription already covers the same Codex usage. Staying put also makes sense when you specifically need Claude in Claude Code or Claude Desktop, or Gemini through Gemini CLI’s native /v1beta route. CheapRelay does not turn every model into an OpenAI-compatible endpoint, and pretending otherwise would produce a broken configuration rather than a lower bill.

For everyone else, the decision is straightforward: use an OpenAI-compatible client under /v1, enter the model id exactly, and compare the published rates with your real token counts. For GPT-6.1 Sol, the example arithmetic is $0.1486 input + $0.7375 output = $0.8861 per million tokens across those two categories, against $12.00 at the official list prices. That is the case to test with CheapRelay before moving a larger workflow.

More reading

DateAisleWritten inTitle
2026-11-05Coding agents, cheaplyENClaude Code via an API proxy costs $0.7375 per 1M output tokens
Compare Claude Code, Codex and Gemini CLI on CheapRelay, an API proxy with published token prices and no monthly fee.
2026-11-04Coding agents, cheaplyENOpenCode API relay: $10.00 official list, $0.7375 per 1M
OpenCode API relay walkthrough with GPT-6.1 Sol at $0.7375 per 1M output tokens, prepaid billing, and the arithmetic behind the price.
2026-11-03Coding agents, cheaplyENCline on CheapRelay: an API relay session from $0.1208
Cline and Roo Code on CheapRelay: an API relay session priced per real token, with no monthly fee and published rates for supported models.
2026-10-30Coding agents, cheaplyENOne Claude Code fix: $18.40 first, $2.13 second
Two Claude Code receipts judged on price per useful result, plus the two environment variables that changed the bill.
2026-10-30Coding agents, cheaplyENRunning Claude Code on $4.10 a Day Instead of $38
Two daily receipts, the same coding work, and a price-per-useful-result verdict. Real token math, no subscriptions.
2026-10-30Coding agents, cheaplyENThe $50 Coding Bill: 6 Habits That Quietly Double It
Six coding assistant habits that quietly double an AI bill, and a $5-a-month workflow that keeps token costs honest.