halfoff.devDocs
Get a key
Models API

Models & pricing

Every model costs half its list price per token: input, output, cache reads and cache writes. See how each call's charge is computed and list models.

The pricing rule fits in one line: you pay half the official list price for every token, on every model. That applies to uncached input, output (thinking and reasoning included), cache reads and cache writes alike.

Prices are quoted in US dollars per million tokens. Each call is charged from the token counts the model reports in its own response, and the amount leaves your prepaid balance a few seconds after the call ends.

Half price, token by token#

Here is what that means on claude-sonnet-5.5, per million tokens:

Token kindList priceYou pay
Uncached input$2.00$1.00
Output$10.00$5.00
Cache read$0.10$0.05
Cache write$2.50$1.25

The same ×0.50 factor applies to every Claude, GPT and Gemini model, in every channel group and in every API format. The live table at the bottom of this page lists the current models.

The formula#

A call's usage breaks down into four token kinds, each with its own price. Where to find them in each API:

Token kindAnthropic usageOpenAI usageGemini usage
Uncached inputinput_tokensprompt_tokens minus cached_tokenspromptTokenCount minus cachedContentTokenCount
Cache readcache_read_input_tokensprompt_tokens_details.cached_tokenscachedContentTokenCount
Cache writecache_creation_input_tokensnot reportednot reported
Outputoutput_tokens (thinking included)completion_tokens (reasoning included)candidatesTokenCount + thoughtsTokenCount

They combine like this:

Text
charge = ( uncached_input × input_price
         + cache_read     × cache_read_price
         + cache_write    × cache_write_price
         + output         × output_price ) ÷ 1,000,000 × multiplier

The prices are the model's list prices, and the multiplier is that of the channel group that answered, named in the x-halfoff-group response header. All three groups bill at ×0.50, which is where the half price comes from. Each charge is rounded up to the next $0.000001.

GPT and Gemini models report no cache writes, so for them only three of the four terms apply.

A worked example#

One turn of a long coding chat on claude-sonnet-5.5, where most of the history comes from the cache:

Token kindTokensYou pay per 1MCost
Uncached input3,000$1.00$0.003000
Cache read50,000$0.05$0.002500
Cache write1,500$1.25$0.001875
Output1,200$5.00$0.006000
Total$0.013375

If none of those 54,500 input tokens had come from the cache, input alone would have cost $0.054500 instead of $0.007375. Caching and the half-price rate stack; Prompt caching shows how to keep the hit rate high.

List models and prices#

GET /v1/models returns every model you can call right now, with context size, your prices (half the list price) and the groups that serve it. It needs no key, and both the OpenAI and the Anthropic SDK can read it with client.models.list().

curl https://halfoff.dev/v1/models

An abridged response:

Response
{
  "object": "list",
  "data": [
    {
      "id": "gemini-3.1-pro",
      "object": "model",
      "type": "model",
      "display_name": "Gemini 3.1 Pro",
      "created": 1700000000,
      "created_at": "2025-01-01T00:00:00Z",
      "owned_by": "Google",
      "context_length": 1048576,
      "pricing": {
        "input": 1,
        "output": 6,
        "cache_read": 0.1,
        "cache_write": 0.1875,
        "unit": "USD per 1M tokens"
      },
      "groups": ["gemini-value"]
    },
    {
      "id": "claude-sonnet-5.5",
      "object": "model",
      "type": "model",
      "display_name": "Claude Sonnet 5.5",
      "created": 1700000000,
      "created_at": "2025-01-01T00:00:00Z",
      "owned_by": "Anthropic",
      "context_length": 1000000,
      "pricing": {
        "input": 1,
        "output": 5,
        "cache_read": 0.05,
        "cache_write": 1.25,
        "unit": "USD per 1M tokens"
      },
      "groups": ["claude-value"]
    }
  ],
  "has_more": false,
  "first_id": "claude-fable-5.1",
  "last_id": "gpt-5.6-luna"
}
FieldMeaning
idThe id to send. Other spellings resolve as well; see Model ids.
owned_byVendor: Anthropic, OpenAI or Google.
context_lengthLargest context window, in tokens.
pricing.inputYour price for uncached input tokens.
pricing.outputYour price for output tokens, thinking and reasoning included.
pricing.cache_readYour price for input tokens read from the prompt cache.
pricing.cache_writeYour price for input tokens written to the cache. null means writes are billed as ordinary input.
pricing.unitAlways USD per 1M tokens.
groupsChannel groups serving the model.
created, created_atFixed placeholders, there for SDK compatibility.

The pricing fields are already your rates: the official list price × ×0.50. GET /v1beta/models lists the same models in Gemini's format, without prices.

Calls that cost nothing#

  • Requests turned away before reaching a model: bad key, model not allowed, no balance, rate limit, malformed JSON.
  • Requests that fail on every channel, and any attempt that failed and was retried elsewhere. Only the attempt that answered is billed.
  • POST /v1/messages/count_tokens and Gemini's :countTokens.
  • Listing models.

Cancelled and interrupted streams#

Close a stream early and you pay for what was produced up to that moment, at the same half-price rates. Input is the count the stream reported, or roughly one token per four characters of your request if it reported nothing. Output is the larger of the count reported so far and roughly one token per four characters of text already delivered.

When the gateway ends a stream because the model went silent, billing works the same way: you pay for what you received. See Streaming.

Where charges show up#

Logs list every call with its token counts and its charge. The marketplace shows each model's price per group with the multiplier applied, plus live availability. Balance and top-ups are in Billing, usage reports in Usage.

Live price table#

The table below is read live from GET /v1/models and shows your rates per million tokens: half the official list price.

ModelContextInputOutputCache readCache write

Live from GET /v1/models · USD per 1M tokens