πͺ’ Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(pricing): add Gemini Priority inference rates (#17392)
langfuse-bot14af2faac5dc
diff --git a/.agents/skills/add-model-price/references/model-audit-memory.md b/.agents/skills/add-model-price/references/model-audit-memory.mdindex 28a91a776a..9a50db7c22 100644--- a/.agents/skills/add-model-price/references/model-audit-memory.md+++ b/.agents/skills/add-model-price/references/model-audit-memory.md@@ -12,20 +12,27 @@ audit date.## Latest useful snapshot-**Audit date:** 2026-09-10+**Audit date:** 2026-09-14All prices listed as `$X / MTok` (per million tokens). Per-token JSON values: divide by 1,000,000.-The 2026-09-10 run re-fetched the full Anthropic pricing table (plus the+The 2026-09-14 run re-fetched the full Anthropic pricing table (plus themodels-overview table), the full OpenAI standard/Fast-mode/Flex pricing tables plus-the full model catalog page, and both Gemini pricing pages (2.5-family and 3.x-family)-plus the Gemini models catalog. Every price already in the file β including-`gpt-6-astra` (added 2026-09-03, not yet reflected in the prior 2026-09-02 snapshot-below) β matched verbatim; no pricing or catalog changes were made. This run also-ran the deterministic validator's `--usage-key-model` check against **every** model in-the file at once (not just changed entries) β see unresolved finding #11 below for the-pre-existing alias-coverage gaps that full sweep surfaced. All rows below except the-new `gpt-6-astra` row are carried over unchanged from the 2026-09-02 snapshot, which+the full model catalog page, both Gemini pricing pages (2.5-family and 3.x-family)+plus the Gemini models catalog, and a dedicated re-fetch of `gpt-5-chat-latest`'s own+model page. The original audit left prices unchanged, but its claim that Gemini+Priority had no request-time selector was incorrect. The focused follow-up verified+the documented `service_tier` parameter and added 13 Priority tiers across 11 Gemini+text models, including the two Pro large-context variants. Existing Standard prices+are unchanged. See the resolved Priority finding below and+`provider-sources-and-price-keys.md` for rates, selectors, and downgrade handling.+The 2026-09-10 run before it re-fetched the same set of official pages and also found+no drift beyond confirming `gpt-6-astra` (added 2026-09-03, not yet reflected in the+prior 2026-09-02 snapshot below) and ran the deterministic validator's+`--usage-key-model` check against **every** model in the file at once (not just+changed entries) β see unresolved finding #11 below for the pre-existing+alias-coverage gaps that full sweep surfaced. All rows below except the `gpt-6-astra`+row are carried over unchanged from the 2026-09-02 snapshot, whichitself re-fetched the full Anthropic pricing table (plus the models-overview table,model-deprecations page, and the dedicated Mythos 5.1 page), the full OpenAIstandard/Fast-mode/Flex pricing tables (plus dedicated pages for `gpt-5.6-sol`,@@ -39,7 +46,7 @@ to have siblings `gpt-5.5-cyber`/`gpt-5.4-cyber`, see provider-sources-and-price| Provider | Model / pricing entry | Pricing checked | Price confirmed | Tiering checked | Tiering correct | Change | Official source(s) | Comments || -------- | --------------------- | --------------- | --------------- | --------------- | --------------- | ------ | ------------------- | -------- |-| OpenAI | gpt-6-astra | Input $10/MTok, Cached $1/MTok, Cache write $12.50/MTok, Output $50/MTok | Yes | Large Context (>272K) 2x/2x/2x/1.5x; Fast mode 2x base; Flex 0.5x base | Yes | None | https://developers.openai.com/api/docs/pricing https://developers.openai.com/api/docs/models/gpt-6-astra | Added 2026-09-03, re-confirmed unchanged 2026-09-10. Six-tier gpt-5.6-sol-style key set. |+| OpenAI | gpt-6-astra | Input $10/MTok, Cached $1/MTok, Cache write $12.50/MTok, Output $50/MTok | Yes | Large Context (>272K) 2x/2x/2x/1.5x; Fast mode 2x base; Flex 0.5x base | Yes | None | https://developers.openai.com/api/docs/pricing https://developers.openai.com/api/docs/models/gpt-6-astra | Added 2026-09-03, re-confirmed unchanged 2026-09-10 and 2026-09-14. Six-tier gpt-5.6-sol-style key set. || Provider | Model / pricing entry | Pricing checked | Price confirmed | Tiering checked | Tiering correct | Change | Official source(s) | Comments || -------- | --------------------- | --------------- | --------------- | --------------- | --------------- | ------ | ------------------ | -------- |@@ -80,7 +87,7 @@ to have siblings `gpt-5.5-cyber`/`gpt-5.4-cyber`, see provider-sources-and-price| OpenAI | gpt-5-mini-2025-08-07 | Input $0.25/MTok, Cached $0.025/MTok, Output $2/MTok | Yes | No large-context tier | Yes | None | https://developers.openai.com/api/docs/pricing | Re-confirmed unchanged. || OpenAI | gpt-5-nano-2025-08-07 | Input $0.05/MTok, Cached $0.005/MTok, Output $0.40/MTok | Yes | No large-context tier | Yes | None | https://developers.openai.com/api/docs/pricing | Re-confirmed unchanged. || OpenAI | gpt-5-pro-2025-10-06 | Input $15/MTok, Output $120/MTok; no cache | Yes | No large-context tier | Yes | None | https://developers.openai.com/api/docs/pricing | Re-confirmed unchanged. |-| OpenAI | gpt-5-chat-latest | Input $1.25/MTok, Cached $0.125/MTok, Output $10/MTok | No | No provider tiering (128,000 token context window) | Not applicable | None | https://developers.openai.com/api/docs/models/gpt-5-chat-latest | Not independently re-fetched this run (last confirmed 2026-08-21); still absent from the aggregate table by design. |+| OpenAI | gpt-5-chat-latest | Input $1.25/MTok, Cached $0.125/MTok, Output $10/MTok | Yes | No provider tiering (128,000 token context window; max input 272,000) | Not applicable | None | https://developers.openai.com/api/docs/models/gpt-5-chat-latest | Re-fetched directly 2026-09-14 (dedicated model page): unchanged. Still absent from the aggregate standard-pricing table by design; that table's summarized row for this alias again showed a stale $5.00/$0.50/$30.00 artifact (matching pre-Aug-24 gpt-5.6-sol figures) this run β do not trust the aggregate table for this alias, always use the dedicated model page. || OpenAI | gpt-4.1-2025-04-14 | Input $2/MTok, Cached $0.50/MTok, Output $8/MTok | Yes | No large-context tier | Yes | None | https://developers.openai.com/api/docs/pricing | Re-confirmed unchanged. || OpenAI | gpt-4.1-mini-2025-04-14 | Input $0.40/MTok, Cached $0.10/MTok, Output $1.60/MTok | Yes | No large-context tier | Yes | None | https://developers.openai.com/api/docs/pricing | Re-confirmed unchanged. || OpenAI | gpt-4.1-nano-2025-04-14 | Input $0.10/MTok, Cached $0.025/MTok, Output $0.40/MTok | Yes | No large-context tier | Yes | None | https://developers.openai.com/api/docs/pricing | Re-confirmed unchanged. |@@ -115,7 +122,7 @@ to have siblings `gpt-5.5-cyber`/`gpt-5.4-cyber`, see provider-sources-and-price| Google | gemini-3.8-flash | Input $0.75, Output $3.75, Cache read $0.075 (through Dec 31, 2026; steps to $1.50/$7.50/$0.15 Jan 1, 2027) | Yes | No large-context tier | Yes | Added | https://ai.google.dev/pricing https://ai.google.dev/gemini-api/docs/pricing https://ai.google.dev/gemini-api/docs/models | New "New Stable" GA model, direct successor to gemini-3.7-flash, described as engineered "for long-horizon software engineering, autonomous agents, and complex enterprise workflows." Same intro pricing and Jan 1 2027 step-up as 3.6/3.7-flash. Added mirroring the gemini-3.7-flash key set exactly, and to `vertexAIModels`/`googleAIStudioModels` (not first entry). || Google | gemini-2.0-flash / gemini-2.0-flash-001 | Input $0.10, Output $0.40 | No | Deprecated (shut down June 1, 2026) | Not applicable | None | https://ai.google.dev/pricing | Not re-verified this run; retained for backward compatibility. |-## Unresolved findings (updated 2026-09-02)+## Unresolved findings (updated 2026-09-14)1. **claude-opus-4-1-20250805 / claude-opus-4-20250514 retirement** β Both still listedas "retired, except on Bedrock and Google Cloud" (Opus 4.1) or "except on Google@@ -221,3 +228,18 @@ to have siblings `gpt-5.5-cyber`/`gpt-5.4-cyber`, see provider-sources-and-priceinside an unrelated price-confirmation audit; a future task that explicitly scopes"backfill legacy alias coverage" should address it deliberately, entry by entry,rather than as an audit side-effect.++## Resolved Priority finding (September 14 2026)++Gemini Priority is representable through `modelParameters.service_tier: "priority"`.+The [Priority guide](https://ai.google.dev/gemini-api/docs/priority-inference) and+[OpenAI compatibility guide](https://ai.google.dev/gemini-api/docs/openai#flex-and-priority-inference)+document the selector. The catalog includes all 11 text models listed in the+Priority guide, with combined Priority/context tiers for both Pro models.+The older snapshot rows above describe Standard prices; the current Priority rates+and exact model list are in `provider-sources-and-price-keys.md`.++Record the actual response tier from `x-gemini-service-tier` in model parameters:+Google can downgrade requests and bill Standard. Native Gemini response-header+capture is not automatic in Langfuse. This catalog update does not implement SDK+instrumentation, Vertex-specific billing, Flex, storage costs, or historical repricing.diff --git a/.agents/skills/add-model-price/references/provider-sources-and-price-keys.md b/.agents/skills/add-model-price/references/provider-sources-and-price-keys.mdindex feee768381..eb41d62bca 100644--- a/.agents/skills/add-model-price/references/provider-sources-and-price-keys.md+++ b/.agents/skills/add-model-price/references/provider-sources-and-price-keys.md@@ -66,7 +66,8 @@ Always fetch pricing from the provider's official docs before editing.`googleAIStudioModels` while keeping the pricing JSON entries intact.- **Gemini cache-read ratio** β Google Gemini models consistently price cached input at10% of the base input price (e.g. Gemini 2.5 Flash: $0.30/MTok input β $0.03/MTok- cached). If a cache-read price in the file diverges from this ratio, treat it as+ cached). Priority tables can round this differently (3.5 Flash-Lite: $0.05 cache+ read on $0.54 input); use the published rate. If a cache-read price in the file diverges from this ratio, treat it assuspicious and verify against the official page before correcting.- **`ai.google.dev/pricing` has separate Free-tier and Paid-tier columns β do not confusethem (resolved July 31 2026)** β The official Gemini pricing table has both a "Free of@@ -594,6 +595,46 @@ file and `openAIModels`in July 27 2026 audit. Official sources:`https://developeadd even if the scope exclusion were lifted. Treat the whole Daybreak cyberfamily (currently three members) as one standing scope exclusion rather thanre-investigating each member separately in future audits.+- **Gemini Priority inference (verified September 14 2026)** β The+ [Priority guide](https://ai.google.dev/gemini-api/docs/priority-inference)+ documents `service_tier: "priority"` on the Interactions API. The+ [OpenAI-compatible API](https://ai.google.dev/gemini-api/docs/openai#flex-and-priority-inference)+ supports the same parameter. This is per-request Gemini Developer API+ processing, not a Vertex capacity reservation.+ Use the existing `model_parameters` condition on `service_tier`, with+ `operator: "in"` and `values: ["priority"]`. Do not include OpenAI's `fast`+ alias. For Pro models, evaluate Priority + >200K before plain Priority and+ standard Large Context (ascending priorities 1, 2, 3).+ Read the actual tier from the response's `x-gemini-service-tier` header:+ requests can be downgraded to Standard and billed at Standard rates. Record+ that actual value in Langfuse `modelParameters.service_tier`; the catalog+ matcher cannot read HTTP headers. Generic OTEL `gen_ai.request.service_tier`+ captures only the requested tier, and native Gemini response-header capture+ is not automatic. Missing tier data falls back to ordinary context pricing.+ The [paid pricing tables](https://ai.google.dev/gemini-api/docs/pricing)+ supply the following Priority USD/MTok rates (input / output / cache read):++ | Model | Input | Output, including thinking | Cache read |+ | --- | --- | --- | --- |+ | gemini-3.6-flash / 3.7-flash / 3.8-flash | 1.35 | 6.75 | 0.135 |+ | gemini-3.5-flash | 2.70 | 16.20 | 0.27 |+ | gemini-3.5-flash-lite | 0.54 | 4.50 | 0.05 |+ | gemini-3.1-flash-lite | 0.45 | 2.70 | 0.045 |+ | gemini-3-flash-preview | 0.90 | 5.40 | 0.09 |+ | gemini-3.1-pro-preview, <=200K / >200K | 3.60 / 7.20 | 21.60 / 32.40 | 0.36 / 0.72 |+ | gemini-2.5-pro, <=200K / >200K | 2.25 / 4.50 | 18 / 27 | 0.225 / 0.45 |+ | gemini-2.5-flash | 0.54 | 4.50 | 0.054 |+ | gemini-2.5-flash-lite | 0.18 | 0.72 | 0.018 |++ Preserve all existing input, cache-read (including `input_cache_read`), output,+ and reasoning aliases in each new tier. Existing audio-input keys use+ $0.90/MTok for 3.1 Flash-Lite, $1.80 for 2.5 Flash, and $0.54 for 2.5 Flash-Lite.+ Keep existing grounding rates unchanged. Do not infer a universal multiplier:+ 3.5 Flash-Lite explicitly lists a $0.05 cache rate. The 3.6/3.7/3.8 Flash rates+ are introductory through December 31, 2026; recheck their January 1 increase.+ These are Developer API rates; do not infer Vertex regional or reserved-capacity+ pricing from them. Retired previews, media models, Flex, cache storage, and new+ modality buckets require separate evidence and are outside this change.Capture:diff --git a/worker/src/constants/default-model-prices.json b/worker/src/constants/default-model-prices.jsonindex eb796298de..d819ce0c98 100644--- a/worker/src/constants/default-model-prices.json+++ b/worker/src/constants/default-model-prices.json@@ -3249,7 +3249,7 @@"modelName": "gemini-2.5-flash","matchPattern": "(?i)^(google(ai)?\/)?(gemini-2.5-flash)$","createdAt": "2025-07-03T13:44:06.964Z",- "updatedAt": "2026-09-09T00:00:00.000Z",+ "updatedAt": "2026-09-14T00:00:00.000Z","pricingTiers": [{"id": "cmcnjkfwn000107l43bf5e8ax_tier_default",@@ -3258,24 +3258,58 @@"priority": 0,"conditions": [],"prices": {- "input": 3e-7,- "input_text": 3e-7,- "input_modality_1": 3e-7,- "prompt_token_count": 3e-7,- "promptTokenCount": 3e-7,- "input_cached_tokens": 3e-8,- "input_cache_read": 3e-8,- "cached_content_token_count": 3e-8,- "output": 0.0000025,- "output_text": 0.0000025,- "output_modality_1": 0.0000025,- "candidates_token_count": 0.0000025,- "candidatesTokenCount": 0.0000025,- "thoughtsTokenCount": 0.0000025,- "thoughts_token_count": 0.0000025,- "output_reasoning_tokens": 0.0000025,- "output_reasoning": 0.0000025,- "input_audio_tokens": 0.000001+ "input": 0.3e-6,+ "input_text": 0.3e-6,+ "input_modality_1": 0.3e-6,+ "prompt_token_count": 0.3e-6,+ "promptTokenCount": 0.3e-6,+ "input_cached_tokens": 0.03e-6,+ "input_cache_read": 0.03e-6,+ "cached_content_token_count": 0.03e-6,+ "output": 2.5e-6,+ "output_text": 2.5e-6,+ "output_modality_1": 2.5e-6,+ "candidates_token_count": 2.5e-6,+ "candidatesTokenCount": 2.5e-6,+ "thoughtsTokenCount": 2.5e-6,+ "thoughts_token_count": 2.5e-6,+ "output_reasoning_tokens": 2.5e-6,+ "output_reasoning": 2.5e-6,+ "input_audio_tokens": 1e-6+ }+ },+ {+ "id": "d21eecda-f90f-4967-9917-0fd4304c32d6",+ "name": "Priority",+ "isDefault": false,+ "priority": 1,+ "conditions": [+ {+ "source": "model_parameters",+ "key": "service_tier",+ "operator": "in",+ "values": ["priority"]+ }+ ],+ "prices": {+ "input": 0.54e-6,+ "input_text": 0.54e-6,+ "input_modality_1": 0.54e-6,+ "prompt_token_count": 0.54e-6,+ "promptTokenCount": 0.54e-6,+ "input_cached_tokens": 0.054e-6,+ "input_cache_read": 0.054e-6,+ "cached_content_token_count": 0.054e-6,+ "output": 4.5e-6,+ "output_text": 4.5e-6,+ "output_modality_1": 4.5e-6,+ "candidates_token_count": 4.5e-6,+ "candidatesTokenCount": 4.5e-6,+ "thoughtsTokenCount": 4.5e-6,+ "thoughts_token_count": 4.5e-6,+ "output_reasoning_tokens": 4.5e-6,+ "output_reasoning": 4.5e-6,+ "input_audio_tokens": 1.8e-6}}]@@ -3285,7 +3319,7 @@"modelName": "gemini-2.5-flash-lite","matchPattern": "(?i)^(google(ai)?\/)?(gemini-2.5-flash-lite)$","createdAt": "2025-07-03T13:44:06.964Z",- "updatedAt": "2026-09-09T00:00:00.000Z",+ "updatedAt": "2026-09-14T00:00:00.000Z","pricingTiers": [{"id": "cmcnjkrfa000207l4fpnh5mnv_tier_default",@@ -3294,24 +3328,58 @@"priority": 0,"conditions": [],"prices": {- "input": 1e-7,- "input_text": 1e-7,- "input_modality_1": 1e-7,- "prompt_token_count": 1e-7,- "promptTokenCount": 1e-7,- "input_cached_tokens": 1e-8,- "input_cache_read": 1e-8,- "cached_content_token_count": 1e-8,- "output": 4e-7,- "output_text": 4e-7,- "output_modality_1": 4e-7,- "candidates_token_count": 4e-7,- "candidatesTokenCount": 4e-7,- "thoughtsTokenCount": 4e-7,- "thoughts_token_count": 4e-7,- "output_reasoning_tokens": 4e-7,- "output_reasoning": 4e-7,- "input_audio_tokens": 3e-7+ "input": 0.1e-6,+ "input_text": 0.1e-6,+ "input_modality_1": 0.1e-6,+ "prompt_token_count": 0.1e-6,+ "promptTokenCount": 0.1e-6,+ "input_cached_tokens": 0.01e-6,+ "input_cache_read": 0.01e-6,+ "cached_content_token_count": 0.01e-6,+ "output": 0.4e-6,+ "output_text": 0.4e-6,+ "output_modality_1": 0.4e-6,+ "candidates_token_count": 0.4e-6,+ "candidatesTokenCount": 0.4e-6,+ "thoughtsTokenCount": 0.4e-6,+ "thoughts_token_count": 0.4e-6,+ "output_reasoning_tokens": 0.4e-6,+ "output_reasoning": 0.4e-6,+ "input_audio_tokens": 0.3e-6+ }+ },+ {+ "id": "8a527fb3-2348-4066-a938-9dccb419400d",+ "name": "Priority",+ "isDefault": false,+ "priority": 1,+ "conditions": [+ {+ "source": "model_parameters",+ "key": "service_tier",+ "operator": "in",+ "values": ["priority"]+ }+ ],+ "prices": {+ "input": 0.18e-6,+ "input_text": 0.18e-6,+ "input_modality_1": 0.18e-6,+ "prompt_token_count": 0.18e-6,+ "promptTokenCount": 0.18e-6,+ "input_cached_tokens": 0.018e-6,+ "input_cache_read": 0.018e-6,+ "cached_content_token_count": 0.018e-6,+ "output": 0.72e-6,+ "output_text": 0.72e-6,+ "output_modality_1": 0.72e-6,+ "candidates_token_count": 0.72e-6,+ "candidatesTokenCount": 0.72e-6,+ "thoughtsTokenCount": 0.72e-6,+ "thoughts_token_count": 0.72e-6,+ "output_reasoning_tokens": 0.72e-6,+ "output_reasoning": 0.72e-6,+ "input_audio_tokens": 0.54e-6}}]@@ -4454,7 +4522,7 @@"modelName": "gemini-2.5-pro","matchPattern": "(?i)^(google(ai)?\/)?(gemini-2.5-pro)$","createdAt": "2025-11-26T13:27:53.545Z",- "updatedAt": "2026-09-09T00:00:00.000Z",+ "updatedAt": "2026-09-14T00:00:00.000Z","pricingTiers": [{"id": "cmig1hb7i000104l72qrzgc6h_tier_default",@@ -4486,7 +4554,7 @@"id": "bcf39e8f-9969-455f-be9a-541a00256092","name": "Large Context","isDefault": false,- "priority": 1,+ "priority": 3,"conditions": [{"usageDetailPattern": "(input|prompt|cached)",@@ -4514,6 +4582,78 @@"output_reasoning_tokens": 15e-6,"output_reasoning": 15e-6}+ },+ {+ "id": "d5830838-8f92-4dc6-9b7e-fe88bf4b3875",+ "name": "Priority Large Context",+ "isDefault": false,+ "priority": 1,+ "conditions": [+ {+ "source": "model_parameters",+ "key": "service_tier",+ "operator": "in",+ "values": ["priority"]+ },+ {+ "usageDetailPattern": "(input|prompt|cached)",+ "operator": "gt",+ "value": 200000,+ "caseSensitive": false+ }+ ],+ "prices": {+ "input": 4.5e-6,+ "input_text": 4.5e-6,+ "input_modality_1": 4.5e-6,+ "prompt_token_count": 4.5e-6,+ "promptTokenCount": 4.5e-6,+ "input_cached_tokens": 0.45e-6,+ "input_cache_read": 0.45e-6,+ "cached_content_token_count": 0.45e-6,+ "output": 27e-6,+ "output_text": 27e-6,+ "output_modality_1": 27e-6,+ "candidates_token_count": 27e-6,+ "candidatesTokenCount": 27e-6,+ "thoughtsTokenCount": 27e-6,+ "thoughts_token_count": 27e-6,+ "output_reasoning_tokens": 27e-6,+ "output_reasoning": 27e-6+ }+ },+ {+ "id": "d390c3ff-1c21-43ae-b7f3-c3337de464b5",+ "name": "Priority",+ "isDefault": false,+ "priority": 2,+ "conditions": [+ {+ "source": "model_parameters",+ "key": "service_tier",+ "operator": "in",+ "values": ["priority"]+ }+ ],+ "prices": {+ "input": 2.25e-6,+ "input_text": 2.25e-6,+ "input_modality_1": 2.25e-6,+ "prompt_token_count": 2.25e-6,+ "promptTokenCount": 2.25e-6,+ "input_cached_tokens": 0.225e-6,+ "input_cache_read": 0.225e-6,+ "cached_content_token_count": 0.225e-6,+ "output": 18e-6,+ "output_text": 18e-6,+ "output_modality_1": 18e-6,+ "candidates_token_count": 18e-6,+ "candidatesTokenCount": 18e-6,+ "thoughtsTokenCount": 18e-6,+ "thoughts_token_count": 18e-6,+ "output_reasoning_tokens": 18e-6,+ "output_reasoning": 18e-6+ }}]},@@ -4598,7 +4738,7 @@"modelName": "gemini-3.1-pro-preview","matchPattern": "(?i)^(google(ai)?\/)?(gemini-3.1-pro-preview(-customtools)?)$","createdAt": "2026-02-19T00:00:00.000Z",- "updatedAt": "2026-09-09T00:00:00.000Z",+ "updatedAt": "2026-09-14T00:00:00.000Z","pricingTiers": [{"id": "55106bba-a5dd-441b-bc0d-5652582b349d_tier_default",@@ -4634,7 +4774,7 @@"id": "ada11e9f-fe0d-465a-92af-ce334d0eedeb","name": "Large Context","isDefault": false,- "priority": 1,+ "priority": 3,"conditions": [{"usageDetailPattern": "(input|prompt|cached)",@@ -4666,6 +4806,86 @@"web_search_queries": 14e-3,"webSearchQueries": 14e-3}+ },+ {+ "id": "2c647939-6d8b-4e92-b578-62e33c6dc085",+ "name": "Priority Large Context",+ "isDefault": false,+ "priority": 1,+ "conditions": [+ {+ "source": "model_parameters",+ "key": "service_tier",+ "operator": "in",+ "values": ["priority"]+ },+ {+ "usageDetailPattern": "(input|prompt|cached)",+ "operator": "gt",+ "value": 200000,+ "caseSensitive": false+ }+ ],+ "prices": {+ "input": 7.2e-6,+ "input_modality_1": 7.2e-6,+ "input_text": 7.2e-6,+ "prompt_token_count": 7.2e-6,+ "promptTokenCount": 7.2e-6,+ "input_cached_tokens": 0.72e-6,+ "input_cache_read": 0.72e-6,+ "cached_content_token_count": 0.72e-6,+ "output": 32.4e-6,+ "output_text": 32.4e-6,+ "output_modality_1": 32.4e-6,+ "candidates_token_count": 32.4e-6,+ "candidatesTokenCount": 32.4e-6,+ "thoughtsTokenCount": 32.4e-6,+ "thoughts_token_count": 32.4e-6,+ "output_reasoning_tokens": 32.4e-6,+ "output_reasoning": 32.4e-6,+ "grounding_queries": 0.014,+ "groundingQueries": 0.014,+ "web_search_queries": 0.014,+ "webSearchQueries": 0.014+ }+ },+ {+ "id": "693d3318-1ee7-42c3-8b01-420e1745c5e1",+ "name": "Priority",+ "isDefault": false,+ "priority": 2,+ "conditions": [+ {+ "source": "model_parameters",+ "key": "service_tier",+ "operator": "in",+ "values": ["priority"]+ }+ ],+ "prices": {+ "input": 3.6e-6,+ "input_modality_1": 3.6e-6,+ "input_text": 3.6e-6,+ "prompt_token_count": 3.6e-6,+ "promptTokenCount": 3.6e-6,+ "input_cached_tokens": 0.36e-6,+ "input_cache_read": 0.36e-6,+ "cached_content_token_count": 0.36e-6,+ "output": 21.6e-6,+ "output_text": 21.6e-6,+ "output_modality_1": 21.6e-6,+ "candidates_token_count": 21.6e-6,+ "candidatesTokenCount": 21.6e-6,+ "thoughtsTokenCount": 21.6e-6,+ "thoughts_token_count": 21.6e-6,+ "output_reasoning_tokens": 21.6e-6,+ "output_reasoning": 21.6e-6,+ "grounding_queries": 0.014,+ "groundingQueries": 0.014,+ "web_search_queries": 0.014,+ "webSearchQueries": 0.014+ }}]},@@ -6594,7 +6814,7 @@"modelName": "gemini-3.5-flash","matchPattern": "(?i)^(google(ai)?\/)?(gemini-3.5-flash)$","createdAt": "2026-05-20T00:00:00.000Z",- "updatedAt": "2026-09-09T00:00:00.000Z",+ "updatedAt": "2026-09-14T00:00:00.000Z","pricingTiers": [{"id": "6ed696e7-5f3a-4113-a233-019155fb3ff0_tier_default",@@ -6625,6 +6845,43 @@"web_search_queries": 14e-3,"webSearchQueries": 14e-3}+ },+ {+ "id": "93ba6a87-613b-440f-891c-3ffec07dbae8",+ "name": "Priority",+ "isDefault": false,+ "priority": 1,+ "conditions": [+ {+ "source": "model_parameters",+ "key": "service_tier",+ "operator": "in",+ "values": ["priority"]+ }+ ],+ "prices": {+ "input": 2.7e-6,+ "input_modality_1": 2.7e-6,+ "input_text": 2.7e-6,+ "prompt_token_count": 2.7e-6,+ "promptTokenCount": 2.7e-6,+ "input_cached_tokens": 0.27e-6,+ "input_cache_read": 0.27e-6,+ "cached_content_token_count": 0.27e-6,+ "output": 16.2e-6,+ "output_text": 16.2e-6,+ "output_modality_1": 16.2e-6,+ "candidates_token_count": 16.2e-6,+ "candidatesTokenCount": 16.2e-6,+ "thoughtsTokenCount": 16.2e-6,+ "thoughts_token_count": 16.2e-6,+ "output_reasoning_tokens": 16.2e-6,+ "output_reasoning": 16.2e-6,+ "grounding_queries": 0.014,+ "groundingQueries": 0.014,+ "web_search_queries": 0.014,+ "webSearchQueries": 0.014+ }}]},@@ -6633,7 +6890,7 @@"modelName": "gemini-3-flash-preview","matchPattern": "(?i)^(google(ai)?\/)?(gemini-3-flash-preview)$","createdAt": "2025-12-21T12:01:42.282Z",- "updatedAt": "2026-09-09T00:00:00.000Z",+ "updatedAt": "2026-09-14T00:00:00.000Z","pricingTiers": [{"id": "cmjfoeykl000004l8ffzra8c7_tier_default",@@ -6664,6 +6921,43 @@"web_search_queries": 14e-3,"webSearchQueries": 14e-3}+ },+ {+ "id": "fae75451-275c-4105-a086-81c2c0905db9",+ "name": "Priority",+ "isDefault": false,+ "priority": 1,+ "conditions": [+ {+ "source": "model_parameters",+ "key": "service_tier",+ "operator": "in",+ "values": ["priority"]+ }+ ],+ "prices": {+ "input": 0.9e-6,+ "input_text": 0.9e-6,+ "input_modality_1": 0.9e-6,+ "prompt_token_count": 0.9e-6,+ "promptTokenCount": 0.9e-6,+ "input_cached_tokens": 0.09e-6,+ "input_cache_read": 0.09e-6,+ "cached_content_token_count": 0.09e-6,+ "output": 5.4e-6,+ "output_text": 5.4e-6,+ "output_modality_1": 5.4e-6,+ "candidates_token_count": 5.4e-6,+ "candidatesTokenCount": 5.4e-6,+ "thoughtsTokenCount": 5.4e-6,+ "thoughts_token_count": 5.4e-6,+ "output_reasoning_tokens": 5.4e-6,+ "output_reasoning": 5.4e-6,+ "grounding_queries": 0.014,+ "groundingQueries": 0.014,+ "web_search_queries": 0.014,+ "webSearchQueries": 0.014+ }}]},@@ -6672,7 +6966,7 @@"modelName": "gemini-3.1-flash-lite","matchPattern": "(?i)^(google(ai)?\/)?(gemini-3.1-flash-lite)$","createdAt": "2026-05-20T00:00:00.000Z",- "updatedAt": "2026-09-09T00:00:00.000Z",+ "updatedAt": "2026-09-14T00:00:00.000Z","pricingTiers": [{"id": "79f4d62c-22fb-4ec3-82e1-6e56cdd5e23c_tier_default",@@ -6704,6 +6998,44 @@"web_search_queries": 14e-3,"webSearchQueries": 14e-3}+ },+ {+ "id": "10a6f73f-c118-4949-a100-2f2ea7d17260",+ "name": "Priority",+ "isDefault": false,+ "priority": 1,+ "conditions": [+ {+ "source": "model_parameters",+ "key": "service_tier",+ "operator": "in",+ "values": ["priority"]+ }+ ],+ "prices": {+ "input": 0.45e-6,+ "input_modality_1": 0.45e-6,+ "input_text": 0.45e-6,+ "prompt_token_count": 0.45e-6,+ "promptTokenCount": 0.45e-6,+ "input_cached_tokens": 0.045e-6,+ "input_cache_read": 0.045e-6,+ "cached_content_token_count": 0.045e-6,+ "output": 2.7e-6,+ "output_text": 2.7e-6,+ "output_modality_1": 2.7e-6,+ "candidates_token_count": 2.7e-6,+ "candidatesTokenCount": 2.7e-6,+ "thoughtsTokenCount": 2.7e-6,+ "thoughts_token_count": 2.7e-6,+ "output_reasoning_tokens": 2.7e-6,+ "output_reasoning": 2.7e-6,+ "input_audio_tokens": 0.9e-6,+ "grounding_queries": 0.014,+ "groundingQueries": 0.014,+ "web_search_queries": 0.014,+ "webSearchQueries": 0.014+ }}]},@@ -6777,7 +7109,7 @@"modelName": "gemini-3.6-flash","matchPattern": "(?i)^(google(ai)?\/)?(gemini-3.6-flash)$","createdAt": "2026-07-22T00:00:00.000Z",- "updatedAt": "2026-09-09T00:00:00.000Z",+ "updatedAt": "2026-09-14T00:00:00.000Z","pricingTiers": [{"id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d_tier_default",@@ -6808,6 +7140,43 @@"web_search_queries": 14e-3,"webSearchQueries": 14e-3}+ },+ {+ "id": "786aefe9-1f56-4e31-ac2d-dd27ba337353",+ "name": "Priority",+ "isDefault": false,+ "priority": 1,+ "conditions": [+ {+ "source": "model_parameters",+ "key": "service_tier",+ "operator": "in",+ "values": ["priority"]+ }+ ],+ "prices": {+ "input": 1.35e-6,+ "input_text": 1.35e-6,+ "input_modality_1": 1.35e-6,+ "prompt_token_count": 1.35e-6,+ "promptTokenCount": 1.35e-6,+ "input_cached_tokens": 0.135e-6,+ "input_cache_read": 0.135e-6,+ "cached_content_token_count": 0.135e-6,+ "output": 6.75e-6,+ "output_text": 6.75e-6,+ "output_modality_1": 6.75e-6,+ "candidates_token_count": 6.75e-6,+ "candidatesTokenCount": 6.75e-6,+ "thoughtsTokenCount": 6.75e-6,+ "thoughts_token_count": 6.75e-6,+ "output_reasoning_tokens": 6.75e-6,+ "output_reasoning": 6.75e-6,+ "grounding_queries": 0.014,+ "groundingQueries": 0.014,+ "web_search_queries": 0.014,+ "webSearchQueries": 0.014+ }}]},@@ -6816,7 +7185,7 @@"modelName": "gemini-3.7-flash","matchPattern": "(?i)^(google(ai)?\/)?(gemini-3.7-flash)$","createdAt": "2026-08-14T00:00:00.000Z",- "updatedAt": "2026-09-09T00:00:00.000Z",+ "updatedAt": "2026-09-14T00:00:00.000Z","pricingTiers": [{"id": "b91d332c-a2fd-b85c-f6e6-971796f3f111_tier_default",@@ -6847,6 +7216,43 @@"web_search_queries": 14e-3,"webSearchQueries": 14e-3}+ },+ {+ "id": "2667be7b-bdb3-4422-bc26-2cb7e0febd2d",+ "name": "Priority",+ "isDefault": false,+ "priority": 1,+ "conditions": [+ {+ "source": "model_parameters",+ "key": "service_tier",+ "operator": "in",+ "values": ["priority"]+ }+ ],+ "prices": {+ "input": 1.35e-6,+ "input_text": 1.35e-6,+ "input_modality_1": 1.35e-6,+ "prompt_token_count": 1.35e-6,+ "promptTokenCount": 1.35e-6,+ "input_cached_tokens": 0.135e-6,+ "input_cache_read": 0.135e-6,+ "cached_content_token_count": 0.135e-6,+ "output": 6.75e-6,+ "output_text": 6.75e-6,+ "output_modality_1": 6.75e-6,+ "candidates_token_count": 6.75e-6,+ "candidatesTokenCount": 6.75e-6,+ "thoughtsTokenCount": 6.75e-6,+ "thoughts_token_count": 6.75e-6,+ "output_reasoning_tokens": 6.75e-6,+ "output_reasoning": 6.75e-6,+ "grounding_queries": 0.014,+ "groundingQueries": 0.014,+ "web_search_queries": 0.014,+ "webSearchQueries": 0.014+ }}]},@@ -6855,7 +7261,7 @@"modelName": "gemini-3.8-flash","matchPattern": "(?i)^(google(ai)?\/)?(gemini-3.8-flash)$","createdAt": "2026-09-02T00:00:00.000Z",- "updatedAt": "2026-09-09T00:00:00.000Z",+ "updatedAt": "2026-09-14T00:00:00.000Z","pricingTiers": [{"id": "c3a9f9a6-b79a-4e42-8835-9f0f8204a709_tier_default",@@ -6886,6 +7292,43 @@"web_search_queries": 14e-3,"webSearchQueries": 14e-3}+ },+ {+ "id": "03c531f0-b254-45ce-b850-43156316fb39",+ "name": "Priority",+ "isDefault": false,+ "priority": 1,+ "conditions": [+ {+ "source": "model_parameters",+ "key": "service_tier",+ "operator": "in",+ "values": ["priority"]+ }+ ],+ "prices": {+ "input": 1.35e-6,+ "input_text": 1.35e-6,+ "input_modality_1": 1.35e-6,+ "prompt_token_count": 1.35e-6,+ "promptTokenCount": 1.35e-6,+ "input_cached_tokens": 0.135e-6,+ "input_cache_read": 0.135e-6,+ "cached_content_token_count": 0.135e-6,+ "output": 6.75e-6,+ "output_text": 6.75e-6,+ "output_modality_1": 6.75e-6,+ "candidates_token_count": 6.75e-6,+ "candidatesTokenCount": 6.75e-6,+ "thoughtsTokenCount": 6.75e-6,+ "thoughts_token_count": 6.75e-6,+ "output_reasoning_tokens": 6.75e-6,+ "output_reasoning": 6.75e-6,+ "grounding_queries": 0.014,+ "groundingQueries": 0.014,+ "web_search_queries": 0.014,+ "webSearchQueries": 0.014+ }}]},@@ -6894,7 +7337,7 @@"modelName": "gemini-3.5-flash-lite","matchPattern": "(?i)^(google(ai)?\/)?(gemini-3.5-flash-lite)$","createdAt": "2026-07-22T00:00:00.000Z",- "updatedAt": "2026-09-09T00:00:00.000Z",+ "updatedAt": "2026-09-14T00:00:00.000Z","pricingTiers": [{"id": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e_tier_default",@@ -6925,6 +7368,43 @@"web_search_queries": 14e-3,"webSearchQueries": 14e-3}+ },+ {+ "id": "75fc1a97-fc1a-4478-8486-6095f6e81b7b",+ "name": "Priority",+ "isDefault": false,+ "priority": 1,+ "conditions": [+ {+ "source": "model_parameters",+ "key": "service_tier",+ "operator": "in",+ "values": ["priority"]+ }+ ],+ "prices": {+ "input": 0.54e-6,+ "input_text": 0.54e-6,+ "input_modality_1": 0.54e-6,+ "prompt_token_count": 0.54e-6,+ "promptTokenCount": 0.54e-6,+ "input_cached_tokens": 0.05e-6,+ "input_cache_read": 0.05e-6,+ "cached_content_token_count": 0.05e-6,+ "output": 4.5e-6,+ "output_text": 4.5e-6,+ "output_modality_1": 4.5e-6,+ "candidates_token_count": 4.5e-6,+ "candidatesTokenCount": 4.5e-6,+ "thoughtsTokenCount": 4.5e-6,+ "thoughts_token_count": 4.5e-6,+ "output_reasoning_tokens": 4.5e-6,+ "output_reasoning": 4.5e-6,+ "grounding_queries": 0.014,+ "groundingQueries": 0.014,+ "web_search_queries": 0.014,+ "webSearchQueries": 0.014+ }}]}diff --git a/worker/src/scripts/upsertDefaultModelPrices.test.ts b/worker/src/scripts/upsertDefaultModelPrices.test.tsindex f643a91075..85d8e8c5e1 100644--- a/worker/src/scripts/upsertDefaultModelPrices.test.ts+++ b/worker/src/scripts/upsertDefaultModelPrices.test.ts@@ -1,4 +1,6 @@import { beforeEach, describe, expect, it, vi } from "vitest";+import Decimal from "decimal.js";+import { matchPricingTier } from "@langfuse/shared/src/server";const transaction = vi.hoisted(() => vi.fn());@@ -144,3 +146,81 @@ describe("default GPT-5.4 mini and nano prices", () => {}});});++describe("default Gemini Pro pricing tiers", () => {+ it.each([+ {+ modelName: "gemini-3.1-pro-preview",+ standard: [2e-6, 12e-6, 0.2e-6],+ standardLarge: [4e-6, 18e-6, 0.4e-6],+ priority: [3.6e-6, 21.6e-6, 0.36e-6],+ priorityLarge: [7.2e-6, 32.4e-6, 0.72e-6],+ },+ {+ modelName: "gemini-2.5-pro",+ standard: [1.25e-6, 10e-6, 0.125e-6],+ standardLarge: [2.5e-6, 15e-6, 0.25e-6],+ priority: [2.25e-6, 18e-6, 0.225e-6],+ priorityLarge: [4.5e-6, 27e-6, 0.45e-6],+ },+ ])(+ "selects $modelName tiers at the cached-input context boundary",+ (expected) => {+ const model = defaultModelPrices.find(+ ({ modelName }) => modelName === expected.modelName,+ );+ expect(model).toBeDefined();+ if (!model) return;++ const tiers = model.pricingTiers.map((tier) => ({+ ...tier,+ conditions:+ tier.conditions as DefaultModelPrice["pricingTiers"][number]["conditions"],+ prices: Object.entries(tier.prices).map(([usageType, price]) => ({+ usageType,+ price: new Decimal(price),+ })),+ }));++ for (const cachedTokens of [50_000, 50_001]) {+ const largeContext = cachedTokens > 50_000;+ for (const serviceTier of ["priority", "standard", undefined]) {+ const priority = serviceTier === "priority";+ const expectedPrices = priority+ ? largeContext+ ? expected.priorityLarge+ : expected.priority+ : largeContext+ ? expected.standardLarge+ : expected.standard;+ const match = matchPricingTier(+ tiers,+ {+ input: 150_000,+ input_cached_tokens: cachedTokens,+ output: 1_000,+ },+ {+ modelParameters: serviceTier ? { service_tier: serviceTier } : {},+ },+ );++ expect(match?.pricingTierName).toBe(+ priority+ ? largeContext+ ? "Priority Large Context"+ : "Priority"+ : largeContext+ ? "Large Context"+ : "Standard",+ );+ expect(+ ["input", "output", "input_cached_tokens"].map((usageType) =>+ match?.prices[usageType].toNumber(),+ ),+ ).toEqual(expectedPrices);+ }+ }+ },+ );+});