Skip to content
AnswerWell geo Documentation

Research · 8 min read · Answerwell

API Token Pricing, Cache Read Rates, and Usage Cost Verification

How Agent API and AI Gateway publish per-token model rates, bill reasoning and tools, and return usage metadata you can reconcile.

Most of this material comes from Perplexity Agent API and Cloudflare AI Gateway documentation, with complementary detail on Brave Answers usage headers. Together they describe how hosted LLM APIs quote per-million-token rates, what besides raw tokens can appear on a bill, and how responses expose counts and costs so you can verify a charge.

Per-token pricing: what you pay for on each request

Section titled “Per-token pricing: what you pay for on each request”

Per-token pricing on agent and chat APIs is usually split into input, output, and cached input (sometimes called cache read), and on several gateways also cache creation (writing prompts into a provider cache). Output-priced reasoning tokens matter whenever a model emits a thinking trace or internal reasoning stream—you pay them at the output rate even when that text is not shown to end users.

Component Typical meaning Cost driver
Input Prompt, system messages, tool results fed to the model Volume and model tier
Output Completion, tool calls, structured fields Often the largest line item
Cache read Tokens served from an existing prompt cache Much lower than fresh input
Cache creation First-time cache write (where supported) Separate rate on some catalogs
Reasoning Extended thinking tokens Billed as output on Perplexity Google and Moonshot docs in this cluster
Non-token fees Web search, URL fetch, search queries Added on agent platforms

Per-request charges can still apply on search-heavy products (for example legacy Sonar search queries pricing in Sonar Deep Research), but the Agent API model catalog in this cluster is organized primarily around tokens plus tool line items illustrated in Perplexity pricing.

Context-length tiers: when the same model ID costs more

Section titled “Context-length tiers: when the same model ID costs more”

Several families use step pricing once context crosses a threshold. On Agent API Models, OpenAI models such as openai/gpt-6.1-sol charge roughly double input and output per million tokens above 272k tokens. xAI xai/grok-4.7 doubles rates at 200k tokens. Anthropic anthropic/claude-haiku-5-5 uses distinct short-context vs long-context rows (≤100k vs >100k). OpenAI gateway pages like GPT-6 Luna label the same idea “short-context” and “long-context” per million.

For budgeting, estimate cost using the tier that matches your actual prompt size after tools append context, not the model’s maximum context window.

Perplexity Agent API: published rates and transparent usage

Section titled “Perplexity Agent API: published rates and transparent usage”

The Agent API quickstart states that you can audit every call:

See exact token counts and published costs for every request.

— Perplexity, Agent API quickstart

AWS Marketplace describes the same commercial model as per-request and per-token pricing for all APIs. The canonical rate table is Agent API Models.

Anthropic, OpenAI, and Google on Agent API

Section titled “Anthropic, OpenAI, and Google on Agent API”

On Agent API Models, Anthropic SKUs are grouped as:

Claude Opus (highest reasoning), Sonnet (balanced), and Haiku (fastest, cheapest).

— Perplexity, Agent API Models

Representative Agent API list prices (USD per 1M tokens, from that table):

Model ID Input Output Cache read
anthropic/claude-opus-5-5 4.00 20.00 0.20
anthropic/claude-sonnet-5-5 2.00 10.00 0.10
anthropic/claude-haiku-5-5 0.10–0.50 0.50–2.50 0.01–0.05
openai/gpt-6-luna 0.10–0.20 0.50–0.75 90% off input (listed)
google/gemini-3.7-flash 0.75 3.75 0.075
perplexity/sonar 0.25 2.50 0.0625

Google’s Agent API section notes Gemini 4 Argon introductory rates through November 30, 2026, and that reasoning tokens are billed at the output-token rate (Agent API Models). The changelog records a August 27, 2026 increase for google/gemini-3.7-flash—always check the live models page before locking forecasts.

max_output_tokens for Anthropic models on Agent API

Section titled “max_output_tokens for Anthropic models on Agent API”

Requests with an anthropic/* model must include max_output_tokens. Perplexity documents:

If omitted, the API returns HTTP 400 with validation failed: max_output_tokens is required when using Anthropic models.

— Perplexity, Agent API Models

That parameter is shared across Agent API, but the hard requirement applies only to Anthropic model IDs.

Tool and search line items (beyond model tokens)

Section titled “Tool and search line items (beyond model tokens)”

Perplexity pricing breaks compound agent calls into components. One documented pattern is openai/gpt-5.6-terra with 500 input + 200 output tokens and 1 web search, totaling $0.0059 (model tokens plus $0.0025 web search). A low-effort research example with openai/gpt-6-luna adds Fast Search and fetch_url for a $0.0022 total. When comparing model list prices, add tool rows for agents that search or fetch URLs.

The equity research brief example shows emitting raw JSON and extracting cost:

./equity_research_brief.py TSLA --json | jq '.usage.cost'

Use that pattern in CI or notebooks to reconcile list prices against charged amounts on real prompts.

Cloudflare AI Gateway and Workers AI: catalog rates and billing mechanics

Section titled “Cloudflare AI Gateway and Workers AI: catalog rates and billing mechanics”

Cloudflare publishes per-1M-token list prices on individual model pages under Models. Those pages align with gateway routing: you select a provider slug such as openai/gpt-5.6-sol or google/gemini-4-argon and pay the posted input, output, and cache rates unless a promotion or Custom Costs override applies.

Unified Billing: credit fee vs inference pass-through

Section titled “Unified Billing: credit fee vs inference pass-through”

AI Gateway pricing explains Unified Billing:

A 5% fee is applied to all credits purchased through Unified Billing. For example, a $100 credit purchase will result in a $105 charge. Inference pricing from providers is passed through with no markup — you pay the same per-token rates as you would directly with the provider.

— Cloudflare, AI Gateway pricing reference

Bring Your Own Keys billing behaves differently from Unified Billing, which matters when interpreting limited-time promos.

Custom Costs for negotiated enterprise rates

Section titled “Custom Costs for negotiated enterprise rates”

AI Gateway features document Custom Costs to override default pricing with your negotiated rates or custom cost models and apply them at the request level for tracking. Use this when dashboard spend should reflect contract price, not the public catalog alone.

Workers AI pricing states that Price in Tokens and Price in Neurons are equivalent displays for comparison—Neurons represent GPU compute for serverless inference. Token columns still help when comparing third-party models routed through the gateway.

Models with no output charge or $0 catalog rows

Section titled “Models with no output charge or $0 catalog rows”

Some SKUs price only input because they emit no completion tokens. Multiple changelogs quote:

Clairic costs $0.10 per million input tokens. Because it generates no tokens, there is no output token charge.

— Cloudflare, Introducing Clairic

Similarly, Decisions lists $0.00 output per 1M tokens, and Jev charges input only. Conversely, Beam 1.0 501B A23B shows $0.00 across input, cached input, and output on the catalog page—treat that as a published list price, not a guarantee of production quota or availability.

Reasoning and effort parameters that change token bills

Section titled “Reasoning and effort parameters that change token bills”
Model / family Billing note Source
perplexity/kimi-k3 Reasoning tokens at output rate; effort levels include minimal … max Agent API Models
google/gemini-4-argon Reasoning tokens at output rate Agent API Models
Moonshot / Fireworks variants Same output-priced reasoning pattern on gateway pages such as Kimi K3 and Ember-1 Cloudflare model docs

Higher reasoning effort generally increases output-class tokens even when answers look short.

Time-limited promotions: gateway discounts vs list price

Section titled “Time-limited promotions: gateway discounts vs list price”

Limited promotions appear repeatedly in Cloudflare changelogs for openai/gpt-5.6-sol through AI Gateway. Wording such as Get 50% off GPT-5.6 Sol includes:

The promotion is available for Unified Billing users only (not Bring Your Own Keys).

— Cloudflare, Get 50% off GPT-5.6 Sol through AI Gateway

During the promotion, illustrative rates are $2.50 input, $15 output, and $0.25 cache read per 1M tokens versus standard $5 / $30 / $0.50, through September 18, 2026. The GPT-5.6 Sol model page also flags a 50% window.

Gemini 4 Argon documents 50% off through November 30, 2026 ($2.00 input, $0.10 cached input, $10.00 output per 1M), reverting to $4.00 / $0.20 / $20.00 on December 1, 2026. Perplexity’s Agent API table lists Argon at $2.00 / $10.00 / $0.10 with introductory wording through the same date (Agent API Models).

Common conclusion: promotional per-token prices are date-bound, often Unified Billing-only on Cloudflare, and must be read alongside the standard catalog row for the same model ID.

Brave Answers API: usage metadata with per-component costs

Section titled “Brave Answers API: usage metadata with per-component costs”

For Brave Answers, responses can embed a usage block with request counts, token counts, and fractional dollar costs per component, for example:

<usage>{ "X-Request-Requests": 1, "X-Request-Queries": 2, "X-Request-Tokens-In": 1234, "X-Request-Tokens-Out": 300, "X-Request-Requests-Cost": 0, "X-Request-Queries-Cost": 0.008, "X-Request-Tokens-In-Cost": 0.00617, "X-Request-Tokens-Out-Cost": 0.0015, "X-Request-Total-Cost": 0.01567 }</usage>

— Brave, Answers — Usage Metadata

Here queries can carry cost even when requests show $0, which matters when tuning how many sub-queries an answers workflow performs.

Perplexity Sonar (legacy) vs Agent API perplexity/sonar

Section titled “Perplexity Sonar (legacy) vs Agent API perplexity/sonar”

Legacy Sonar pages quote different headline token rates—for example Sonar Pro lists $3 input and $15 output per 1M tokens, while Agent API Models lists perplexity/sonar at $0.25 / $2.50 with cache read $0.0625. These are separate product surfaces. Pick pricing from the API you actually call (Agent API models table vs legacy Sonar models).

Common mistakes when estimating LLM API cost

Section titled “Common mistakes when estimating LLM API cost”
  • Ignoring output-class reasoning tokens on Gemini, Kimi, and similar models that bill reasoning at the output rate.
  • Using maximum context instead of your tier threshold (272k on several OpenAI Agent API models, 200k on Grok, 100k on Haiku 5.5).
  • Omitting tool fees (web_search, fetch_url, Brave queries) from agent estimates.
  • Assuming promos apply with BYOK when documentation restricts discounts to Unified Billing.
  • Forgetting max_output_tokens on anthropic/* Agent API calls, causing HTTP 400 before any tokens are metered.
  • Treating $0 output catalog entries (Clairic, Jev, Decisions) as “free inference”—input tokens still accrue.
  • Comparing Cloudflare catalog to Agent API without checking whether both providers list the same slug at the same date (changelog raises matter, e.g. Gemini 3.7 Flash).
  1. Open Agent API Models and note input, output, and cache read for your exact model string, including tier thresholds.
  2. For compound agent calls, walk through the component table on Perplexity pricing and add tool rows to token math.
  3. On Cloudflare, confirm whether you use Unified Billing or BYOK via AI Gateway pricing, then read the model page (for example GPT-5.6 Sol) for active promotions.
  4. Log response usage: jq '.usage.cost' per the equity research brief example, or parse Brave Answers usage metadata fields X-Request-Total-Cost and sub-cost keys.
  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page does not match the linked documentation, email yimasynthetic@gmail.com with the page URL and the exact sentence you think is wrong, and we will clarify or correct it.