feat: add multi-layer custom_pricing for Anthropic models#720
feat: add multi-layer custom_pricing for Anthropic models#720bhishmendramahala-crypto wants to merge 1 commit intomainfrom
Conversation
b213848 to
8bce4f4
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new custom_pricing structure to Anthropic model pricing to support multi-layer pricing by region and execution mode (while keeping pricing_config as a fallback for older gateway versions).
Changes:
- Introduces
custom_pricing.regions.{global,us}.execution_modesforclaude-opus-4-6(standard/batch/fast) andclaude-sonnet-4-6(standard/batch). - Adds cache token pricing entries (
cache_write_input_token,cache_read_input_token) to the top-levelbatch_configfor both models. - Adds US-region uplifted pricing (10%) and fast-mode pricing for Opus.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "price": 0.0008250000000000001 | ||
| }, | ||
| "cache_write_input_token": { | ||
| "price": 0.00020625000000000003 |
There was a problem hiding this comment.
US-region Sonnet batch cache_write_input_token.price is 0.00020625000000000003 (float artifact). Please simplify to 0.00020625 for consistency and readability.
| "price": 0.00020625000000000003 | |
| "price": 0.00020625 |
| "request_token": { | ||
| "price": 0.0033000000000000004 | ||
| }, |
There was a problem hiding this comment.
The US fast-mode request_token price is written as 0.0033000000000000004 (float precision artifact). Please normalize this to 0.0033 (and similarly for any other uplift-derived values) for consistency and to avoid unnecessary diffs.
| "price": 0.0013750000000000001 | ||
| }, | ||
| "cache_write_input_token": { | ||
| "price": 0.00034375000000000003 | ||
| }, |
There was a problem hiding this comment.
More US-region batch prices show float precision artifacts (e.g., response_token.price is 0.0013750000000000001). Please normalize these values (e.g., 0.001375) to avoid noisy diffs and improve readability.
| "price": 0.00034375000000000003 | ||
| }, | ||
| "cache_read_input_token": { | ||
| "price": 0.000027500000000000004 |
There was a problem hiding this comment.
cache_read_input_token.price under US batch pricing is 0.000027500000000000004 (float artifact). Please simplify to 0.0000275 (or the intended exact decimal) for consistency.
| "price": 0.000027500000000000004 | |
| "price": 0.0000275 |
| "price": 0.0016500000000000002 | ||
| }, | ||
| "cache_write_input_token": { | ||
| "price": 0.00041250000000000005 |
There was a problem hiding this comment.
US-region Sonnet cache_write_input_token.price is 0.00041250000000000005 (float artifact). Please simplify to 0.0004125 (or the intended exact decimal) for consistency.
| "price": 0.00041250000000000005 | |
| "price": 0.0004125 |
| "price": 0.0027500000000000003 | ||
| }, | ||
| "cache_write_input_token": { | ||
| "price": 0.0006875000000000001 | ||
| }, |
There was a problem hiding this comment.
US-region prices contain floating-point precision artifacts (e.g., response_token.price is 0.0027500000000000003). Please normalize these numeric literals to their intended decimal forms (e.g., 0.00275) to keep the JSON readable and reduce downstream stringify/diff churn.
| "price": 0.0006875000000000001 | ||
| }, | ||
| "cache_read_input_token": { | ||
| "price": 0.00005500000000000001 |
There was a problem hiding this comment.
cache_read_input_token.price is written as 0.00005500000000000001 (float artifact). Please simplify this to the exact decimal value (e.g., 0.000055) for consistency with the rest of the file.
| "price": 0.00005500000000000001 | |
| "price": 0.000055 |
| "price": 0.000165 | ||
| }, | ||
| "response_token": { | ||
| "price": 0.0008250000000000001 |
There was a problem hiding this comment.
US-region Sonnet batch response_token.price is 0.0008250000000000001 (float artifact). Please normalize this to 0.000825 to keep numeric formatting consistent.
| "price": 0.0008250000000000001 | |
| "price": 0.000825 |
…d claude-sonnet-4-6 - claude-opus-4-6: standard + fast execution modes, global + us regions - standard: pay_as_you_go + batch_config (50% rate) with cache entries - fast: pay_as_you_go only (6x standard rates, no batch) - us region: 10% uplift on all standard and fast prices - claude-sonnet-4-6: standard execution mode, global + us regions - standard: pay_as_you_go + batch_config (50% rate) with cache entries - us region: 10% uplift on standard prices - Existing pricing_config preserved as fallback for older gateway versions (batch_config removed from pricing_config — now lives in custom_pricing)
8bce4f4 to
2f9ccfc
Compare
Summary
custom_pricingwith nestedregionsandexecution_modesforclaude-opus-4-6andclaude-sonnet-4-6standard:pay_as_you_gowith full token + cache pricingbatch:pay_as_you_go+batch_config(50% of standard rates)fast:pay_as_you_go(6x standard — Anthropic fast mode, Opus only)usregion: 1.1x uplift on all pricesstandard:pay_as_you_gowith full token + cache pricingbatch:pay_as_you_go+batch_config(50% of standard rates)usregion: 1.1x uplift on all pricespricing_config(withpay_as_you_go+batch_config) preserved as fallback for older gateway versionsSource Verification
Source Links:
Checklist
jqor an online validatorRelated