feat: add custom pricing configuration for OpenAI models#770
Open
prabhash-varma wants to merge 19 commits into
Open
feat: add custom pricing configuration for OpenAI models#770prabhash-varma wants to merge 19 commits into
prabhash-varma wants to merge 19 commits into
Conversation
- Gemini 2.5 Pro: standard/priority/batch execution modes with <=200K/>200K context tier boundaries and grounding search prices - Gemini 2.5 Flash, Flash Lite, Flash Image: standard/priority/batch modes (flat, no context tiers) - Gemini 3.x series (3 Pro, 3 Flash, 3.1 Pro, 3.1 Flash-Lite, 3.1 Flash Image): standard/priority/batch with context tiers where applicable - Claude models (Opus 4.6, Sonnet 4.6, Haiku 4.5, plus versioned aliases): regional custom_pricing for global, us-east5, europe-west1, asia-southeast1, asia-east1 - New model entries: gemma-4-26b-it, llama-4-scout, llama-4-maverick, gpt-oss-20b-maas, grok-4.20-maas, grok-4.1-fast-maas, deepseek-ocr-maas, mistral-ocr-2505, veo-3.1-lite-generate-preview - Existing pricing_config + batch_config preserved as default fallback - general/vertex-ai.json updated with new model entries
…_write_input_token rounding - Convert all 455 scientific notation values to decimal (e.g. 5e-05 → 0.00005) - Fix batch cache_write_input_token from 0.000188 to 0.0001875 (exact 50% of standard 0.000375) Addresses PR review comments from sivadurga-d and Copilot.
…e_token in custom_pricing - Fix 22 floating point rounding artifacts (e.g. 0.00007499999999999999 → 0.000075) caused by toFixed(20) during scientific notation conversion - Add image_token to additional_units in custom_pricing for 4 image models (gemini-2.5-flash-image, gemini-3-pro-image-preview, gemini-2.5-flash-image-preview, gemini-3.1-flash-image-preview) so billing works via both response_image_token and additional_units.image_token paths
- Add asia-east1 region (1.1x multiplier) to 7 Claude models missing it: claude-sonnet-4-5-20250929, claude-sonnet-4-5@20250929, claude-opus-4-5-20251101, claude-opus-4-5@20251101, anthropic.claude-opus-4-6, claude-opus-4-6, claude-sonnet-4-6 - Add cache_write_input_token to 18 custom_pricing blocks where base config had it but custom_pricing didn't (gemini-3-pro, gemini-3-flash, gemini-3.1-pro, gemini-3.1-flash-lite, and their variants) - Add image_token to additional_units in 12 custom_pricing blocks (gemini-3-pro-preview, gemini-2.5-flash, gemini-3.1-pro-preview, gemini-2.5-flash-preview-09-2025; standard/priority get base rate, batch gets 50%) - Fix remaining scientific notation from JSON.stringify
…ding - Add cache_write_input_token to 24 context_tier blocks across gemini-3-pro-preview, gemini-3-pro-preview-02-05, gemini-3.1-pro-preview, gemini-3.1-pro-preview-customtools (all modes × both tiers) - Add image_token to 12 context_tier blocks for models with base image_token pricing (gemini-3-pro-preview, gemini-3.1-pro-preview) - Fix 45 rounded regional cache_write/cache_read values for Claude models to exact 1.1x of default (e.g. 0.000413 → 0.0004125 for Sonnet, 0.0003438 → 0.00034375 for Opus batch, 0.0000688 → 0.00006875 for Haiku)
Fix cache_write_input_token from 0.0000688 to 0.00006875 in asia-east1 batch pricing for claude-haiku-4-5-20251001 and claude-haiku-4-5@20251001, matching the exact 1.1x multiplier used in other regions.
Align all veo model pricing with Google's published per-second rates (in cents/second to match repo convention) and add resolution + audio dimensions for the pricing gaps PR code: - veo-3.1: add video_seconds_1080p=20, video_seconds_4k=40, video_audio_seconds=20 - veo-3.1-fast: fix video_seconds from 10/15 to 8 (video-only 720p), add 1080p=10, 4k=25, audio=2 - veo-3.1-lite: convert from dollars to cents (0.03→3, 0.05→5), fix audio surcharge (0.05→2), remove unused video_audio_seconds_1080p - veo-3.0: add video_seconds_1080p=20, video_audio_seconds=20 - veo-3.0-fast: fix video_seconds from 10/20 to 8, add 1080p=10, audio=2 - veo-2.0: no change (50 cents/s, 720p only, no audio) Source: https://cloud.google.com/vertex-ai/generative-ai/pricing
Fixes found during full review pass: - Fix batch cache_write_input_token to be 50% of standard (not copied from base pay_as_you_go) for 5 gemini models across 14 locations: gemini-3-pro-preview, gemini-3-pro-preview-02-05, gemini-3-flash-preview, gemini-3.1-pro-preview, gemini-3.1-pro-preview-customtools, gemini-3.1-flash-lite-preview (also fixes context_tier batch blocks) - Add missing @-notation aliases to general/vertex-ai.json: claude-sonnet-4-5@20250929, claude-haiku-4-5@20251001, claude-opus-4-5@20251101
…tex-ai.json The @ notation Claude models in general/ use the anthropic. prefix (e.g. anthropic.claude-sonnet-4-5@20250929) which were already present on main. The bare-name entries (claude-sonnet-4-5@20250929 etc.) are pricing routing aliases only and don't belong in general/.
Ensures pricing_config (used by older gateways) has correct values matching custom_pricing standard mode, not stale/incomplete data. Fixes: - 6 wrong token prices (request, response, cache_read) - 2 wrong web_search/search prices (3.5 → 1.4) - 15 missing request_audio_token entries - 21 missing maps entries - 7 missing enterprise_web_search entries - 5 missing cache_read_input_token entries
…te/vertex-ai-multi-layer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Source Verification
Pricing: https://developers.openai.com/api/docs/pricing?latest-pricing=standard&multimodal-image-pricing=standard&video-pricing=standard&specialized-pricing=priority&ft-pricing=standard
Region: https://developers.openai.com/api/docs/guides/your-data
Source Link: [Add link here]
Important
Please include a link to the official pricing page from the provider. Simple "I heard it from somewhere" or screenshot sources are not accepted.
Checklist
jqor an online validatorRelated Issue
Fixes # (issue)