Skip to main content
Most surprises on an inference bill come from a few places: a model larger than the task needs, reasoning tokens nobody planned for, prompts that never hit the cache, and conversations that grow with every turn. This page is for developers who want their Gloo AI spend to be predictable, and who want to know which levers change it.
New to how requests are priced? Cost and Speed in the AI Learning Center explains tokens, rates, caching and reasoning effort, and Pricing at a Glance lists what each product costs.
This page covers how to:
  • know what a request costs, from the catalog and from usage
  • match the model to each step of your app
  • control reasoning and output tokens
  • get more cache hits
  • keep conversations and images from growing the bill
  • track spend and set a ceiling

Know what a request costs

Every inference request is billed per token, at the rates in the model catalog (GET /platform/v2/models):
  • Input tokens are everything you send: instructions, conversation history, documents and images. They bill at pricing.input.
  • Output tokens are everything the model writes, including any reasoning, whether or not you see it. They bill at pricing.output, which is usually several times the input rate.
  • Cached tokens bill at pricing.cache_read, and on some models writing the cache bills at pricing.cache_write. See Prompt Caching.
How the model’s rate becomes your price depends on the endpoint family, not on the model. Direct endpoints bill the model’s published rate. Guarded endpoints are priced at the model’s rate plus 6.5%, the guarded platform price, which pays for guardrails, output moderation and values alignment. Choose between them by who should own safety in your app, then control cost with the levers on this page, which work the same on both. See Pricing at a glance for grounded endpoints, embeddings and System One. Every response reports what it used in usage. Estimate each request’s cost from it, and log the result next to the model and the feature that made the call:
This leaves out cache writes, which some models bill separately (cache_write_tokens in the same details object), and the higher pricing.long_context rates some models charge once a prompt passes min_prompt_tokens, so treat it as an estimate. Read the Cache Fields in usage shows every field by endpoint, and your Usage page in Studio is the record of what you were charged.

Match the model to each step

Rates differ widely across the catalog, and the most capable model is rarely needed for every step. As of November 2026, Claude Sonnet 5.5 lists $2 per million input tokens and $10 per million output tokens, while GPT-6 Luna lists $0.10 and $0.50.
  • Split your app into steps (classify, extract, draft, check) and choose a model per step. Short classifications, routing decisions and extractions often run well on small, fast models; long reasoning and careful writing may need a larger one.
  • Test the cheaper model first on your own examples, and move up only where quality falls short. See Testing, Evaluation and Observability.
  • Pin the model you chose. A pinned model is billed at that model’s catalog rate on every call, rather than a rate that changes per request. On guarded Completions, model_family and auto-routing can pick a different model, at a different price, per request.
  • Watch for replacements. Pinning isn’t a price guarantee: when a model you use is deprecated, its requests can be redirected to a replacement priced differently, and deprecation_note states any increase. Check catalog rates on a schedule, log the X-Gloo-Model-Redirected-From header, and follow Model Updates. See Choosing, Pinning and Updating Models.

Control reasoning and output tokens

Output tokens cost the most, and on reasoning models much of the output is thinking.
  • Know which models think unprompted. A model with reasoning.thinks_by_default: true reasons, and bills that reasoning, even when you send no reasoning setting.
  • Lower the effort, not the limit. The reasoning effort is the main control over how long a model thinks. Use low, or none on a model whose effort_levels include it, for short tasks. Lowering max_output_tokens (or max_tokens) doesn’t make the model think less; it cuts the answer off when thinking uses the limit.
  • The limit is a ceiling, not a charge. You pay for the output tokens the model uses, not for the limit you set. Size the limit so answers aren’t cut off, then let effort set the cost. See Size the limit.
  • Read where output went. Where the model reports it, usage.output_tokens_details.reasoning_tokens (Responses) or usage.completion_tokens_details.reasoning_tokens (Chat Completions) is the part of the output that was reasoning. Claude models report it as 0 or leave it out on some endpoints, and their reasoning is still in the output count.
  • Ask for shorter answers. “Answer in two sentences” or a tight output schema cuts output tokens on every model.
Reasoning Models in Production covers effort and limits in more depth.

Get more cache hits

Prompt caching bills the repeated start of a prompt at the much lower cache_read rate, usually around a tenth of the input rate. It only works when the start of the prompt is identical to a recent request, token for token.
  • Put stable content first. Order each request from most stable to least: instructions, reference documents, tool definitions, conversation history, then the new question. Keep timestamps, user names and per-request snippets at the end.
  • Keep the prefix byte-identical. Build it from the same template every time; don’t reorder examples, tools or JSON keys between requests.
  • Turn on caching where it’s opt-in. Claude models cache when you send the X-Cache-TTL header (5m or 1h); on Anthropic Messages use cache_control. OpenAI, DeepSeek, Gemini and most other models cache automatically above a minimum prompt length.
  • Use a stable prompt_cache_key on OpenAI models, named after the prompt it caches, such as "support-assistant-v3", and change it when the instructions change. Per-request keys defeat the cache.
  • Check that it works. Log the cached-token count from usage with every request. A hit rate that drops to zero usually means something started changing the prefix. Expect fewer hits for a while after a provider failover, since each provider holds its own cache.
The Prompt Caching guide lists the rates and rules for each provider, and the Prompt Caching tutorial restructures a prompt and measures the savings step by step.

Keep conversations and images in check

Your app sends the whole conversation on every request, so every turn bills all the turns before it again. A 30-turn conversation sends all 30 turns on turn 31.
  • Trim or summarise long histories. Keep the instructions and the recent turns; drop or summarise the oldest. See Conversations and Context Windows.
  • Append, don’t rewrite. Adding new turns to the end keeps the earlier conversation as a cacheable prefix.
  • Mind images. An image is billed as input tokens at the model’s input rate, and again on every turn it stays in the history. Scale images down before you send them, and describe an image once and keep the text when the conversation moves on. See Images in Conversations.
  • Send only the context the question needs. Retrieving the three most relevant passages costs less than pasting a whole document, and often answers better.

Track spend and set a ceiling

  • Watch the Usage page. API Usage in Gloo AI Studio shows spend, requests and tokens (input, output and cache) over time. Filter by API key to see which application is spending, so give each application and environment its own API key.
  • Log usage per feature. Studio shows totals; your own logs tell you which feature or customer drove them. Record the model, the token counts and your cost estimate with every request.
  • Know your ceiling. Organizations on prepaid credits have a monthly API spend limit, $4,000 per calendar month (UTC) unless Gloo has set a different one. When it’s reached, requests return 429 with MONTHLY_SPEND_LIMIT_REACHED until the month resets. Contact support to raise or lower it, including lowering it as a safety net for a new app.
  • Cap your own loops. Retries, tool loops and agents can multiply requests. Bound them with a retry budget and a step limit. See Error Handling and Retries and Tools, Structured Output and Agents.

Summary

  • Output costs more than input, and reasoning is output: control it with effort, not by shrinking the limit.
  • Pick the smallest model that passes your tests for each step, and pin it.
  • Put stable content first, turn on caching where it’s opt-in, and check the cached-token count.
  • Trim long conversations and shrink images, since every turn resends them.
  • Log usage per feature, filter Studio usage by API key, and know your monthly spend limit.

Next steps

Cost and Speed

The lesson: how a request is priced, caching and reasoning effort.

Prompt Caching tutorial

Restructure a prompt for caching and measure the savings.

Reasoning Models in Production

Effort, output limits, streaming and cut-off answers.

API Usage

Spend, requests and tokens in Studio.