diff --git a/.audit/model-cost-accounting.tsv b/.audit/model-cost-accounting.tsv new file mode 100644 index 000000000..f857454ad --- /dev/null +++ b/.audit/model-cost-accounting.tsv @@ -0,0 +1,11 @@ +ts phase decision why evidence result +2026-09-19T16:12:50Z isolation resumed feat/model-cost-accounting-20260907 in its dedicated T3 worktree kept the primary checkout and unrelated worktrees untouched git worktree list --porcelain isolated dirty feature branch confirmed +2026-09-19T16:12:50Z revalidation will rebase the accounting work onto current main before release main now routes inference through OpenRouter and changed both AI handlers origin/main 99c2b53, PR #43 old provider-specific implementation cannot ship unchanged +2026-09-19T16:16:50Z pricing refreshed all three official pricing captures with exact tsx 4.19.2 under Node 22 the September 7 unfinished capture was stale for this run docs/pricing-snapshots/metadata.json 11 normalized entries found and gemini-3.1-flash-lite-preview remains unknown +2026-09-19T16:38:03Z integration rebased onto current main and kept the OpenRouter-only handlers PR 43 replaced the plan's direct-provider runtime after the plan was written origin/main 99c2b53 accounting requirements applied to current architecture +2026-09-19T16:38:03Z verification ran the focused, Edge, Vitest, coverage, build, and Chromium gates under Node 22 required fresh evidence before opening the PR local command output 181 Edge, 161 Supabase Vitest, 1026 coverage, and 134 Chromium tests passed +2026-09-19T16:38:03Z browser recorded desktop and Pixel 7 admin accounting proof with isolated fixture data show importer volume while excluding it from model and feature cost rows https://github.com/user-attachments/assets/1e833f00-8163-41e1-a4ee-ca8d0bb28fa2 video attached to PR 46 +2026-09-19T16:49:00Z review fixed all three release-review blockers with focused regressions abort-after-finish, historical stored costs, and API row caps needed explicit coverage supabase/functions/ai-stream/index_test.ts, supabase/functions/_shared/admin-cost.test.ts reviewer confirmed no remaining P1 issue +2026-09-19T16:57:59Z staging deployed the three changed functions and ran protected authenticated staging exercise the real account, provider, persistence, and cleanup path before review https://github.com/Programcode/DebateLab/actions/runs/35456451358 ai v18, ai-stream v18, admin v13, protected browser run passed +2026-09-19T16:57:59Z database inspected the staging request written by the protected run prove deployed OpenRouter accounting stored audit metadata and a real charge staging ai_requests at 2026-09-19T16:56:33Z 785 input, 70 output, 0.00015275 USD, raw usage and audit version present +2026-09-19T17:57:28Z review made every stream exception fail closed and corrected the admin unknown-cost label provider errors after a finish reason must never retain a billable cost; unknown cost is broader than missing token data supabase/functions/ai-stream/index_test.ts, src/test/pages/AdminPage.test.tsx regression added; 181 Edge, 161 Supabase Vitest, 1026 coverage, and 134 Chromium tests passed diff --git a/docs/pricing-snapshots/anthropic.md b/docs/pricing-snapshots/anthropic.md index 44df92de8..05793231b 100644 --- a/docs/pricing-snapshots/anthropic.md +++ b/docs/pricing-snapshots/anthropic.md @@ -12,23 +12,27 @@ For the most current pricing information, visit [claude.com/pricing](https://cla The following table shows pricing for all Claude models: -| Model | Base Input Tokens | 5m Cache Writes | 1h Cache Writes | Cache Hits & Refreshes | Output Tokens | -| ------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | --------------- | --------------- | ---------------------- | ------------- | -| Claude Fable 5 | $10 / MTok | $12.50 / MTok | $20 / MTok | $1 / MTok | $50 / MTok | -| Claude Mythos 5 ([limited availability](https://anthropic.com/glasswing)) | $10 / MTok | $12.50 / MTok | $20 / MTok | $1 / MTok | $50 / MTok | -| Claude Opus 5 | $5 / MTok | $6.25 / MTok | $10 / MTok | $0.50 / MTok | $25 / MTok | -| Claude Opus 4.8 | $5 / MTok | $6.25 / MTok | $10 / MTok | $0.50 / MTok | $25 / MTok | -| Claude Opus 4.7 | $5 / MTok | $6.25 / MTok | $10 / MTok | $0.50 / MTok | $25 / MTok | -| Claude Opus 4.6 | $5 / MTok | $6.25 / MTok | $10 / MTok | $0.50 / MTok | $25 / MTok | -| Claude Opus 4.5 | $5 / MTok | $6.25 / MTok | $10 / MTok | $0.50 / MTok | $25 / MTok | -| Claude Opus 4.1 ([retired, except on Bedrock and Google Cloud](https://platform.claude.com/docs/en/about-claude/model-deprecations)) | $15 / MTok | $18.75 / MTok | $30 / MTok | $1.50 / MTok | $75 / MTok | -| Claude Opus 4 ([retired, except on Google Cloud](https://platform.claude.com/docs/en/about-claude/model-deprecations)) | $15 / MTok | $18.75 / MTok | $30 / MTok | $1.50 / MTok | $75 / MTok | -| Claude Sonnet 5 | $2 / MTok | $2.50 / MTok | $4 / MTok | $0.20 / MTok | $10 / MTok | -| Claude Sonnet 4.6 | $3 / MTok | $3.75 / MTok | $6 / MTok | $0.30 / MTok | $15 / MTok | -| Claude Sonnet 4.5 | $3 / MTok | $3.75 / MTok | $6 / MTok | $0.30 / MTok | $15 / MTok | -| Claude Sonnet 4 ([retired, except on Bedrock and Google Cloud](https://platform.claude.com/docs/en/about-claude/model-deprecations)) | $3 / MTok | $3.75 / MTok | $6 / MTok | $0.30 / MTok | $15 / MTok | -| Claude Haiku 4.5 | $1 / MTok | $1.25 / MTok | $2 / MTok | $0.10 / MTok | $5 / MTok | -| Claude Haiku 3.5 ([retired, except on Bedrock and Google Cloud](https://platform.claude.com/docs/en/about-claude/model-deprecations)) | $0.80 / MTok | $1 / MTok | $1.60 / MTok | $0.08 / MTok | $4 / MTok | +| Model | Base input tokens | 5m cache writes | 1h cache writes | Cache hits and refreshes | Output tokens | +| :------------------------------------------------------------------------------------------------------------------------------------ | :---------------- | :-------------- | :-------------- | :----------------------- | :------------ | +| Claude Fable 5.1 | $10 / MTok | $12.50 / MTok | $20 / MTok | $0.25 / MTok1 | $50 / MTok | +| Claude Mythos 5.1 ([limited availability](https://anthropic.com/glasswing)) | $10 / MTok | $12.50 / MTok | $20 / MTok | $0.25 / MTok1 | $50 / MTok | +| Claude Fable 5 | $10 / MTok | $12.50 / MTok | $20 / MTok | $1 / MTok | $50 / MTok | +| Claude Mythos 5 ([limited availability](https://anthropic.com/glasswing)) | $10 / MTok | $12.50 / MTok | $20 / MTok | $1 / MTok | $50 / MTok | +| Claude Opus 5 | $5 / MTok | $6.25 / MTok | $10 / MTok | $0.50 / MTok | $25 / MTok | +| Claude Opus 4.8 | $5 / MTok | $6.25 / MTok | $10 / MTok | $0.50 / MTok | $25 / MTok | +| Claude Opus 4.7 | $5 / MTok | $6.25 / MTok | $10 / MTok | $0.50 / MTok | $25 / MTok | +| Claude Opus 4.6 | $5 / MTok | $6.25 / MTok | $10 / MTok | $0.50 / MTok | $25 / MTok | +| Claude Opus 4.5 | $5 / MTok | $6.25 / MTok | $10 / MTok | $0.50 / MTok | $25 / MTok | +| Claude Opus 4.1 ([retired, except on Bedrock and Google Cloud](https://platform.claude.com/docs/en/about-claude/model-deprecations)) | $15 / MTok | $18.75 / MTok | $30 / MTok | $1.50 / MTok | $75 / MTok | +| Claude Opus 4 ([retired, except on Google Cloud](https://platform.claude.com/docs/en/about-claude/model-deprecations)) | $15 / MTok | $18.75 / MTok | $30 / MTok | $1.50 / MTok | $75 / MTok | +| Claude Sonnet 5 | $2 / MTok | $2.50 / MTok | $4 / MTok | $0.20 / MTok | $10 / MTok | +| Claude Sonnet 4.6 | $3 / MTok | $3.75 / MTok | $6 / MTok | $0.30 / MTok | $15 / MTok | +| Claude Sonnet 4.5 | $3 / MTok | $3.75 / MTok | $6 / MTok | $0.30 / MTok | $15 / MTok | +| Claude Sonnet 4 ([retired, except on Bedrock and Google Cloud](https://platform.claude.com/docs/en/about-claude/model-deprecations)) | $3 / MTok | $3.75 / MTok | $6 / MTok | $0.30 / MTok | $15 / MTok | +| Claude Haiku 4.5 | $1 / MTok | $1.25 / MTok | $2 / MTok | $0.10 / MTok | $5 / MTok | +| Claude Haiku 3.5 ([retired, except on Bedrock and Google Cloud](https://platform.claude.com/docs/en/about-claude/model-deprecations)) | $0.80 / MTok | $1 / MTok | $1.60 / MTok | $0.08 / MTok | $4 / MTok | + +*1 Cache hits and refreshes on Claude Fable 5.1 and Claude Mythos 5.1 are priced at 0.025x the base input price. All other models use the standard 0.1x multiplier.* The $2/$10 per million input/output token pricing for Claude Sonnet 5, announced at launch as introductory pricing through August 31, 2026, is now the standard price. The previously scheduled increase to $3/$15 per million input/output tokens on September 1, 2026 will not occur. @@ -138,13 +142,13 @@ There are two ways to enable prompt caching: Prompt caching uses the following pricing multipliers relative to base input token rates: -| Cache operation | Multiplier | Duration | -| -------------------- | ---------------------- | ------------------------------------ | -| 5-minute cache write | 1.25x base input price | Cache valid for 5 minutes | -| 1-hour cache write | 2x base input price | Cache valid for 1 hour | -| Cache read (hit) | 0.1x base input price | Same duration as the preceding write | +| Cache operation | Multiplier | Duration | +| -------------------- | ------------------------------------------------------------------------ | ------------------------------------ | +| 5-minute cache write | 1.25x base input price | Cache valid for 5 minutes | +| 1-hour cache write | 2x base input price | Cache valid for 1 hour | +| Cache read (hit) | 0.1x base input price (0.025x on Claude Fable 5.1 and Claude Mythos 5.1) | Same duration as the preceding write | -Cache write tokens are charged when content is first stored. Cache read tokens are charged when a subsequent request retrieves the cached content. A cache hit costs 10% of the standard input price, which means caching pays off after one cache read for the 5-minute duration (1.25x write), or after two cache reads for the 1-hour duration (2x write). +Cache write tokens are charged when content is first stored. Cache read tokens are charged when a subsequent request retrieves the cached content. A cache hit costs 10% of the standard input price, which means caching pays off after one cache read for the 5-minute duration (1.25x write), or after two cache reads for the 1-hour duration (2x write). On Claude Fable 5.1 and Claude Mythos 5.1, a cache hit costs 2.5% of the standard input price ($0.25 USD per million tokens). These multipliers stack with other pricing modifiers, including the Batch API discount and data residency. @@ -182,7 +186,9 @@ For more information, see [Fast mode](https://platform.claude.com/docs/en/build- The Batch API allows asynchronous processing of large volumes of requests with a 50% discount on both input and output tokens. | Model | Batch input | Batch output | -| ------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------- | +| :------------------------------------------------------------------------------------------------------------------------------------ | :----------- | :------------ | +| Claude Fable 5.1 | $5 / MTok | $25 / MTok | +| Claude Mythos 5.1 ([limited availability](https://anthropic.com/glasswing)) | $5 / MTok | $25 / MTok | | Claude Fable 5 | $5 / MTok | $25 / MTok | | Claude Mythos 5 ([limited availability](https://anthropic.com/glasswing)) | $5 / MTok | $25 / MTok | | Claude Opus 5 | $2.50 / MTok | $12.50 / MTok | @@ -501,19 +507,19 @@ Contact the sales team at [sales@anthropic.com](mailto:sales@anthropic.com) or t ## Frequently asked questions -**How is token usage calculated?** +### How is token usage calculated? Tokens are pieces of text that models process. As a rough estimate, 1 token is approximately 4 characters or 0.75 words in English. The exact count varies by language and content type. -**Are there free tiers or trials?** +### Are there free tiers or trials? New users receive a small amount of free credits to test the API. [Contact sales](mailto:sales@anthropic.com) for information about extended trials for enterprise evaluation. -**How do discounts stack?** +### How do discounts stack? Batch API and prompt caching discounts can be combined. For example, using both features together provides significant cost savings compared to standard API calls. See [prompt caching pricing](https://platform.claude.com/docs/en/about-claude/pricing#prompt-caching) for how the multipliers interact. -**What payment methods are accepted?** +### What payment methods are accepted? Major credit cards are accepted for standard accounts. Enterprise customers can arrange invoicing and other payment methods. diff --git a/docs/pricing-snapshots/google-gemini.html b/docs/pricing-snapshots/google-gemini.html index 90d09f551..477d2643a 100644 --- a/docs/pricing-snapshots/google-gemini.html +++ b/docs/pricing-snapshots/google-gemini.html @@ -25,11 +25,11 @@ + href="//fonts.googleapis.com/css2?family=Material+Icons&family=Material+Symbols+Outlined&display=block"> - - - + + All models + alt-paths=" /gemini-api/docs/models/gemini-3.1-flash-image /gemini-api/docs/models/gemini-3.1-flash-lite-image /gemini-api/docs/models/gemini-3.1-pro-preview /gemini-api/docs/models/gemini-3-pro-preview /gemini-api/docs/models/gemini-3-pro-image /gemini-api/docs/models/gemini-3.8-flash /gemini-api/docs/models/gemini-3.7-flash /gemini-api/docs/models/gemini-3.6-flash /gemini-api/docs/models/gemini-3.5-flash /gemini-api/docs/models/gemini-3.8-live /gemini-api/docs/models/gemini-3.8-live-extended-thinking /gemini-api/docs/models/gemini-3.5-live-translate-preview /gemini-api/docs/models/gemini-3-flash-preview /gemini-api/docs/models/gemini-3.1-flash-tts-preview /gemini-api/docs/models/veo-3.1-lite-generate-preview /gemini-api/docs/models/gemini-3.1-flash-live-preview /gemini-api/docs/models/gemini-3.5-flash-lite /gemini-api/docs/models/gemini-3.1-flash-lite /gemini-api/docs/models/gemini-3.1-flash-lite-preview /gemini-api/docs/models/gemini-2.5-flash /gemini-api/docs/models/gemini-2.5-flash-preview-09-2025 /gemini-api/docs/models/gemini-2.5-flash-image /gemini-api/docs/models/gemini-2.5-flash-native-audio-preview-12-2025 /gemini-api/docs/models/gemini-2.5-flash-preview-tts /gemini-api/docs/models/gemini-2.5-flash-lite /gemini-api/docs/models/gemini-2.5-flash-lite-preview-09-2025 /gemini-api/docs/models/gemini-2.5-pro /gemini-api/docs/models/gemini-2.5-pro-preview-tts /gemini-api/docs/models/gemini-2.5-computer-use-preview-10-2025 /gemini-api/docs/models/gemini-2.0-flash /gemini-api/docs/models/gemini-2.0-flash-lite /gemini-api/docs/models/imagen /gemini-api/docs/models/veo-3.1-generate-preview /gemini-api/docs/models/veo-2.0-generate-001 /gemini-api/docs/models/gemini-embedding-001 /gemini-api/docs/models/gemini-embedding-2 /gemini-api/docs/models/gemini-robotics-er-1.5-preview /gemini-api/docs/models/gemini-robotics-er-2-preview /gemini-api/docs/models/gemini-robotics-er-2-streaming-preview /gemini-api/docs/models/gemini-robotics-er-1.6-preview /gemini-api/docs/models/deep-research-pro-preview-12-2025 /gemini-api/docs/models/deep-research-preview-04-2026 /gemini-api/docs/models/deep-research-max-preview-04-2026 /gemini-api/docs/models/antigravity-preview-05-2026 /gemini-api/docs/models/lyria-realtime-exp /gemini-api/docs/models/lyria-3.5 /gemini-api/docs/models/lyria-3-clip-preview /gemini-api/docs/models/lyria-3-pro-preview /gemini-api/docs/models/gemini-omni-flash /gemini-api/docs/models/gemini-3.5-transcribe ">All models
  • Gemini Omni Flash
  • -
  • +
    + Lyria 3.5 & Lyria Clip +
  • Text-to-speech
  • +
  • Transcribe
  • +
  • Live
  • @@ -961,37 +965,17 @@ Robotics + >Video understanding
  • @@ -1030,15 +1014,13 @@ devsite-nav-expandable">
  • + >Audio understanding
  • Audio transcription
  • @@ -1075,13 +1057,9 @@ class="devsite-nav-title" >Quickstart
  • -
  • Antigravity agent
  • + >Antigravity agent
  • Environments
  • +
  • Credentials
  • +
  • Hooks
  • -
  • Deep Research agent
  • + >Deep Research agent
  • @@ -1128,38 +1106,26 @@ class="devsite-nav-title" >URL context
  • -
  • Computer use
  • + >Computer use
  • File search
  • -
  • Combine tools and function calling
  • + >Combine tools and function calling
  • Live API
  • -
  • Overview
  • + >Overview
  • @@ -1175,6 +1141,18 @@ class="devsite-nav-title" >Capabilities
  • +
  • Thinking
  • + +
  • Live transcription
  • +
  • Live translation
  • @@ -1187,13 +1165,9 @@ class="devsite-nav-title" >Session management -
  • Ephemeral tokens
  • + >Ephemeral tokens
  • Batch API
  • -
  • Webhooks
  • + >Webhooks -
  • Flex inference
  • + >Flex inference -
  • Priority inference
  • + >Priority inference
  • Deploying your app
  • Agents in AI Studio Playground
  • Agents in AI Studio Playground
  • Try out LearnLM
  • Try out LearnLM
  • Troubleshooting
  • - The Interactions API is now generally available. We recommend using this API for access to all the latest features and models. + Gemini 3.8 Flash is now available. Try it out.
    @@ -3226,6 +3184,7 @@

    +

    Start building free of charge with generous limits, then scale up with @@ -3258,7 +3217,7 @@

    -

    Gemma 4

    +

    Gemma 4

    Our lightweight, state-of the art, open model built from the same technology @@ -7378,7 +7065,7 @@

    Pricing f File search Free of charge - Charged for embeddings at $0.15 / 1M tokens.
    Retrieved document tokens charged as regular tokens per model pricing. + Charged for embeddings at $0.15 / 1M tokens.
    Retrieved document tokens charged as regular tokens per model pricing. Custom Tools endpoint (Gemini 3.1 Pro Preview) @@ -7443,6 +7130,12 @@

    Pricing

    Notes