Skip to content

feat(pricing): add AWS GovCloud and Azure Government pricing for missing models - #38789

Closed
mateo-berri wants to merge 2 commits into
litellm_internal_stagingfrom
litellm_govcloud_pricing_lit6421
Closed

feat(pricing): add AWS GovCloud and Azure Government pricing for missing models#38789
mateo-berri wants to merge 2 commits into
litellm_internal_stagingfrom
litellm_govcloud_pricing_lit6421

Conversation

@mateo-berri

@mateo-berri mateo-berri commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • 16 GovCloud and Azure Government models had no pricing in the cost map
  • GovCloud requests silently billed at commercial rates, about 17% under the invoice
  • Mantle GovCloud models (Terra, Luna, gpt-5.4, grok-4.3) failed cost lookup with a 500
  • bedrock/us-gov-*/meta.llama3-8b-instruct-v1:0 output price was 4.4x too high

How it solves it:

  • Adds 27 cost map entries priced from AWS offer files, the AWS pricing page, and the Azure retail prices API
  • Fixes the llama3-8b GovCloud output price to $0.60 per million tokens
  • Adds one regression test per model family in tests/test_litellm/test_bedrock_usgov_pricing.py
  • Whitelists the new region-prefixed chat keys in whitelisted_bedrock_models.txt, the same way every existing bedrock/us-gov-* chat key is, so the legacy test_model_info_bedrock_converse guard keeps passing

User Flow

Before: a developer whose gateway routes Claude Sonnet 5 through AWS GovCloud sees it logged at the commercial rate, and the GovCloud Mantle models cannot be priced at all

  1. The proxy admin adds a deployment with model: bedrock/anthropic.claude-sonnet-5 and aws_region_name: us-gov-west-1 (config or POST https://litellm-domain/model/new)
  2. The developer sends POST https://litellm-domain/v1/chat/completions with "model": "claude-sonnet-5" and gets a 200
  3. They open https://litellm-domain/ui/?page=logs and the request shows spend at $2.00 per million input and $10.00 per million output tokens, the commercial rate, while the GovCloud invoice bills $2.40 and $12.00
  4. The admin adds model: bedrock_mantle/openai.gpt-5.6-terra with aws_region_name: us-gov-west-1, and every request to it logs at $0.00 because the cost lookup fails with "This model isn't mapped yet"
  5. The admin adds model: azure/<deployment> with model_info: {base_model: azure/us-gov/gpt-5.1} for their Azure Government deployment, and requests log at $1.25 and $10.00 per million instead of the Azure Government $1.72 and $13.75
  6. Their meta.llama3-8b-instruct-v1:0 GovCloud requests log at $2.65 per million output tokens, 4.4x the real $0.60

After: the same requests log at the GovCloud and Azure Government rates

  1. The proxy admin adds a deployment with model: bedrock/anthropic.claude-sonnet-5 and aws_region_name: us-gov-west-1 (config or POST https://litellm-domain/model/new)
  2. The developer sends POST https://litellm-domain/v1/chat/completions with "model": "claude-sonnet-5" and gets a 200
  3. They open https://litellm-domain/ui/?page=logs and the request shows spend at $2.40 per million input and $12.00 per million output tokens, matching the GovCloud invoice
  4. Requests to bedrock_mantle/openai.gpt-5.6-terra in us-gov-west-1 log at $2.64 per million input and $15.84 per million output (the 272k long-context tier applies above that prompt size)
  5. The Azure Government gpt-5.1 deployment logs at $1.72 per million input and $13.75 per million output
  6. meta.llama3-8b-instruct-v1:0 GovCloud requests log at $0.60 per million output tokens

Pricing evidence

Every AWS price is the 20260826181919 AmazonBedrock offer file for the region (pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonBedrock/current/us-gov-west-1/index.json and the us-gov-east-1 sibling), which puts every GovCloud SKU at exactly 1.2x the commercial price. The Claude models are Marketplace-billed and have no offer file rows, so their prices come from the AWS Bedrock pricing page's GovCloud (US) and GovCloud (US-East) tables, which are identical. Azure Government prices come from the Azure retail prices API (prices.azure.com/api/retail/prices, serviceName eq 'Foundry Models', armRegionName usgovvirginia and usgovarizona), Data Zone meters for gpt-5.1 and o3-mini

Region coverage was decided per model from the AWS model cards plus the offer files, and where the two disagreed the more recent source won. Terra and Luna are GA in both GovCloud regions (the 2026-08-24 What's New post aws.amazon.com/about-aws/whats-new/2026/08/openai-gpt-terra-luna-govcloud/ and both model cards list us-gov-east-1 as in-region with an identical price table) while the east offer file has not published their SKUs yet, so both region keys ship with the west prices. openai.gpt-5.4 is the reverse: its model card lists west only, but the east offer file already publishes UGE1-openai.gpt-5.4-mantle rows at the same prices, so both region keys ship. xai.grok-4.3 is west only on both sources, so only the west key ships. The gov offer files carry no long-context SKUs for gpt-5.4, so its gov entries have no above_272k tier

Relevant issues

Linear ticket

Resolves LIT-6421

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

No GovCloud or Azure Government credentials were reachable for a real provider call (none in .env, and the 1Password desktop app was locked), so the proof drives the proxy's own cost engine through POST /spend/calculate, the same path spend logs go through. Both legs boot the same config on the same port with 2 uvicorn workers and send the same 15 requests; only the checked-out commit differs. Each request carries 1,000,000 prompt and 1,000,000 completion tokens so the returned cost reads as dollars per million on each side

Shared setup

# config.yaml
model_list:
  - model_name: dummy
    litellm_params:
      model: gpt-3.5-turbo
      api_key: not-a-real-key
LITELLM_MASTER_KEY=sk-qa-lit6421 LITELLM_LOCAL_MODEL_COST_MAP=True \
  python -m litellm.proxy.proxy_cli --config config.yaml --port 33404 --num_workers 2

cost() {
  curl -sS http://127.0.0.1:33404/spend/calculate \
    -H "Authorization: Bearer sk-qa-lit6421" -H 'Content-Type: application/json' \
    -d '{"completion_response": {"id": "qa", "object": "chat.completion", "created": 1, "model": "'"$1"'", "choices": [{"index": 0, "message": {"role": "assistant", "content": "hi"}, "finish_reason": "stop"}], "usage": {"prompt_tokens": '"${2:-1000000}"', "completion_tokens": '"${3:-1000000}"', "total_tokens": 2000000}}}'
  echo
}

Before (06852ca)

Llama 3 8B GovCloud output price

  1. cost bedrock/us-gov-west-1/meta.llama3-8b-instruct-v1:0
    {"cost":2.9499999999999997} ($0.30 input + $2.65 output; the output rate is wrong)

Claude Sonnet 5 and Opus 4.8 (region keys and us-gov. profiles)

  1. cost bedrock/us-gov-west-1/anthropic.claude-sonnet-5
    {"cost":12.0} (commercial $2.00 + $10.00, no GovCloud entry)
  2. cost bedrock/us-gov-east-1/anthropic.claude-opus-4-8
    {"cost":30.0} (commercial $5.00 + $25.00)
  3. cost us-gov.anthropic.claude-sonnet-5
    {"cost":12.0}
  4. cost us-gov.anthropic.claude-opus-4-8
    {"cost":30.0}

Nemotron and gpt-oss

  1. cost bedrock/us-gov-west-1/nvidia.nemotron-super-3-120b
    {"cost":0.8} (commercial $0.15 + $0.65)
  2. cost bedrock/us-gov-east-1/openai.gpt-oss-120b-1:0
    {"cost":0.75} (commercial $0.15 + $0.60)

Mantle: Terra, Luna, gpt-5.4, grok-4.3

  1. cost bedrock_mantle/us-gov-west-1/openai.gpt-5.6-terra
    {"error":{"message":"This model isn't mapped yet. model=bedrock_mantle/us-gov-west-1/openai.gpt-5.6-terra, custom_llm_provider=bedrock_mantle. Add it here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json.","type":"None","param":"None","code":"500"}}
  2. cost bedrock_mantle/us-gov-east-1/openai.gpt-5.6-luna
    {"error":{"message":"This model isn't mapped yet. model=bedrock_mantle/us-gov-east-1/openai.gpt-5.6-luna, custom_llm_provider=bedrock_mantle. Add it here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json.","type":"None","param":"None","code":"500"}}
  3. cost bedrock_mantle/us-gov-east-1/openai.gpt-5.4
    {"error":{"message":"This model isn't mapped yet. model=bedrock_mantle/us-gov-east-1/openai.gpt-5.4, custom_llm_provider=bedrock_mantle. Add it here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json.","type":"None","param":"None","code":"500"}}
  4. cost bedrock_mantle/us-gov-west-1/xai.grok-4.3
    {"error":{"message":"This model isn't mapped yet. model=bedrock_mantle/us-gov-west-1/xai.grok-4.3, custom_llm_provider=bedrock_mantle. Add it here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json.","type":"None","param":"None","code":"500"}}
  5. cost bedrock_mantle/us-gov-east-1/xai.grok-4.3
    {"error":{"message":"This model isn't mapped yet. model=bedrock_mantle/us-gov-east-1/xai.grok-4.3, custom_llm_provider=bedrock_mantle. Add it here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json.","type":"None","param":"None","code":"500"}}

Azure Government gpt-5.1, o3-mini, text-embedding-3-large

  1. cost azure/us-gov/gpt-5.1
    {"cost":11.25} (commercial $1.25 + $10.00)
  2. cost azure/us-gov/o3-mini
    {"cost":5.5} (commercial $1.10 + $4.40)
  3. cost azure/us-gov/text-embedding-3-large 1000000 0
    {"cost":0.13} (commercial $0.13)

After (7be56c6)

Llama 3 8B GovCloud output price

  1. cost bedrock/us-gov-west-1/meta.llama3-8b-instruct-v1:0
    {"cost":0.8999999999999999} ($0.30 input + $0.60 output)

Claude Sonnet 5 and Opus 4.8 (region keys and us-gov. profiles)

  1. cost bedrock/us-gov-west-1/anthropic.claude-sonnet-5
    {"cost":14.4} ($2.40 + $12.00)
  2. cost bedrock/us-gov-east-1/anthropic.claude-opus-4-8
    {"cost":36.0} ($6.00 + $30.00)
  3. cost us-gov.anthropic.claude-sonnet-5
    {"cost":14.4}
  4. cost us-gov.anthropic.claude-opus-4-8
    {"cost":36.0}

Nemotron and gpt-oss

  1. cost bedrock/us-gov-west-1/nvidia.nemotron-super-3-120b
    {"cost":0.96} ($0.18 + $0.78)
  2. cost bedrock/us-gov-east-1/openai.gpt-oss-120b-1:0
    {"cost":0.8999999999999999} ($0.18 + $0.72)

Mantle: Terra, Luna, gpt-5.4, grok-4.3

  1. cost bedrock_mantle/us-gov-west-1/openai.gpt-5.6-terra
    {"cost":29.04} (1M prompt tokens crosses the 272k tier: $5.28 + $23.76)
  2. cost bedrock_mantle/us-gov-east-1/openai.gpt-5.6-luna
    {"cost":2.9040000000000004} (exactly one tenth of Terra, tier included)
  3. cost bedrock_mantle/us-gov-east-1/openai.gpt-5.4
    {"cost":23.1} ($3.30 + $19.80, no long-context tier in GovCloud)
  4. cost bedrock_mantle/us-gov-west-1/xai.grok-4.3
    {"cost":4.5} ($1.50 + $3.00)
  5. cost bedrock_mantle/us-gov-east-1/xai.grok-4.3
    {"error":{"message":"This model isn't mapped yet. model=bedrock_mantle/us-gov-east-1/xai.grok-4.3, custom_llm_provider=bedrock_mantle. Add it here - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json.","type":"None","param":"None","code":"500"}} (still unmapped on purpose: grok-4.3 is not offered in us-gov-east-1)

Azure Government gpt-5.1, o3-mini, text-embedding-3-large

  1. cost azure/us-gov/gpt-5.1
    {"cost":15.46875} ($1.71875 + $13.75)
  2. cost azure/us-gov/o3-mini
    {"cost":7.563} ($1.513 + $6.05)
  3. cost azure/us-gov/text-embedding-3-large 1000000 0
    {"cost":0.16299999999999998} ($0.163)

Type

🆕 New Feature
🐛 Bug Fix

Caveats (if any)

Medium

  • The proof exercises the cost engine through /spend/calculate, not a real GovCloud completion
    • No GovCloud or Azure Government credentials were reachable (none in .env, 1Password desktop app locked); a real completion per family is queued on the ticket for when they land
    • The region-prefixed key shape is the one the existing us-gov-* Claude entries already resolve through in production

Low

  • bedrock_mantle/us-gov-east-1/openai.gpt-5.4 ships on the east offer file alone while its model card still lists west only; dropping the key would leave east requests with no price at all, so it stays
  • Azure Government embedding prices come from the usgovarizona meters because usgovvirginia publishes no text-embedding-3 meters yet; every other gov model prices identically in both regions, so they stay
  • Terra and Luna east prices rest on the model cards and GA post; the east offer file has not published their SKUs yet
  • No Claude keys under bedrock_mantle/us-gov-*: the map carries no commercial Mantle Claude precedent to mirror
  • xai.grok-4.3 stays west only, where the model card and the east offer file agree
  • The new bedrock/us-gov-* chat keys carry litellm_provider: bedrock plus a whitelist entry, the same shape as every existing gov region key; converse routing keys off the base model, so nothing changes at request time
  • tests/llm_translation/test_bedrock_govcloud.py::test_govcloud_completion_with_cost_tracking fails locally at the merge base and at this tip with the same botocore[crt] missing-dependency error, unrelated to this change

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR
  • 7be56c6 passes /live-pr-risk

Note

Low Risk
Data-only pricing and whitelist updates plus tests; no runtime routing or auth changes, though incorrect rates would affect billing visibility until corrected.

Overview
Extends model_prices_and_context_window.json (and its backup) so spend/cost lookup works for government-cloud SKUs instead of falling back to commercial rates or failing with “model isn't mapped.”

Azure Government adds azure/us-gov/* entries for gpt-5.1, o3-mini, and text-embedding-3-small/large with gov-specific token prices.

AWS GovCloud Bedrock adds region-prefixed keys for Claude Sonnet 5 and Opus 4.8 (bedrock/us-gov-* and us-gov.* converse profiles), Nemotron and gpt-oss chat models in both gov regions, and corrects meta.llama3-8b-instruct-v1:0 output cost from the erroneous 70B rate to $0.60/MTok.

Bedrock Mantle adds gov entries for gpt-5.6-terra/luna (including 272k tiers), gpt-5.4 (standard tier only), and xai.grok-4.3 (west only).

tests/test_litellm/test_bedrock_usgov_pricing.py gains parametrized regressions for each family (1.2× commercial where applicable). whitelisted_bedrock_models.txt lists the new bedrock/us-gov-* chat keys so existing Bedrock converse model-info guards keep passing.

Reviewed by Cursor Bugbot for commit 7be56c6. Bugbot is set up for automated code reviews on this repo. Configure here.

…ing models

Adds GovCloud (us-gov-west-1 / us-gov-east-1) pricing entries for Claude
Sonnet 5, Claude Opus 4.8, Nemotron Nano 3 30B, Nemotron Nano 12B v2,
Nemotron Super 3 120B, gpt-oss-20b, gpt-oss-120b, GPT-5.6 Terra, GPT-5.6
Luna, GPT-5.4, and grok-4.3 (west only), plus Azure Government entries
for gpt-5.1, o3-mini, text-embedding-3-large, and text-embedding-3-small.

Also fixes the existing gov llama3-8b entries, which carried the 70B
output rate ($2.65/MTok) instead of the $0.60/MTok the AWS offer file
publishes.
@greptile-apps

greptile-apps Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR expands government-cloud pricing coverage and corrects an existing GovCloud Llama output rate.

  • Adds AWS GovCloud pricing and capability metadata for Claude, Nemotron, GPT-OSS, and Bedrock Mantle models.
  • Adds Azure Government pricing for GPT-5.1, o3-mini, and text-embedding-3 models.
  • Updates the Bedrock whitelist and adds pricing regression tests across the affected model families.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
model_prices_and_context_window.json Adds the primary Azure Government and AWS GovCloud pricing metadata and corrects the Llama 3 8B output rate.
litellm/model_prices_and_context_window_backup.json Mirrors the government-cloud pricing additions and rate correction in the backup cost map.
tests/test_litellm/test_bedrock_usgov_pricing.py Adds local, network-free assertions for the new pricing entries, regional coverage, and long-context tiers.
whitelisted_bedrock_models.txt Whitelists the newly introduced region-qualified Bedrock GovCloud chat-model identifiers.

Reviews (2): Last reviewed commit: "fix(pricing): whitelist the new GovCloud..." | Re-trigger Greptile

@mateo-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mateo-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@mateo-berri mateo-berri added run-ci and removed run-ci labels Aug 29, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 7be56c6. Configure here.

@codspeed-hq

codspeed-hq Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_govcloud_pricing_lit6421 (7be56c6) with litellm_internal_staging (002d006)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (817bbe1) during the generation of this report, so 002d006 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@dlamoris

dlamoris commented Aug 30, 2026

Copy link
Copy Markdown

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Closing as superseded by the rolling registry PR #39170, which carries the offer-file verified GovCloud and Azure Government subset and lists the dropped east and profile keys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants