Skip to content

feat(azure_ai): add Foundry gpt-6.2, gpt-image-2.5, and MAI cost rows - #53783

Closed
Bytechoreographer wants to merge 3 commits into
BerriAI:mainfrom
Bytechoreographer:litellm_azure_ai_gpt62_gptimage25
Closed

Bytechoreographer wants to merge 3 commits into
BerriAI:mainfrom
Bytechoreographer:litellm_azure_ai_gpt62_gptimage25

Conversation

@Bytechoreographer

@Bytechoreographer Bytechoreographer commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

[insert handwritten description here]

Details

TLDR

Problem this solves:

  • Foundry ships gpt-6.2, gpt-image-2.5, MAI-Image-2.7, and MAI-Code-2-Flash with no azure_ai cost row
  • Lookups resolve to the bare OpenAI rows or miss the cost map entirely

How it solves it:

  • Adds seven azure_ai/ rows priced from the Foundry retail price sheet
  • Keeps the root cost map and its bundled backup byte-identical

User Flow

Before: model lookups for these Foundry deployments return the wrong row or nothing

  1. The proxy starts with a cost map that has no azure_ai/gpt-6.2-sol row
  2. GET http://localhost:4000/utils/model_info?model=azure_ai/gpt-6.2-sol returns key gpt-6.2-sol and provider openai
  3. GET http://localhost:4000/utils/model_info?model=azure_ai/MAI-Image-2.7 returns 404 not in the model cost map

After: the same lookups return the azure_ai rows

  1. The proxy starts with the cost map from this PR
  2. GET http://localhost:4000/utils/model_info?model=azure_ai/gpt-6.2-sol returns key azure_ai/gpt-6.2-sol, provider azure_ai, successor azure_ai/gpt-6.1-sol, deprecation 2027-11-17
  3. GET http://localhost:4000/utils/model_info?model=azure_ai/MAI-Image-2.7 returns key azure_ai/MAI-Image-2.7 with image token rates

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<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
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Screenshots / Proof of Fix

The models are not deployable in my Foundry subscription, so there is no live generation call. The changed surface is the cost map lookup itself, exercised through a local proxy on port 4000.

Shared setup (server, proxy start, curl loop)
mkdir -p /tmp/costmap
# copy the model_prices_and_context_window.json of the leg you are running into /tmp/costmap
python3 -m http.server 8111 --directory /tmp/costmap &

cat > /tmp/azure_ai_cost_proof.yaml <<'YAML'
model_list:
  - model_name: keepalive
    litellm_params:
      model: openai/gpt-4o
      api_key: dummy
general_settings:
  master_key: sk-proof-azure-ai-gpt62-2f8a4c9d1e6b7a30
YAML

LITELLM_MODEL_COST_MAP_URL=http://localhost:8111/model_prices_and_context_window.json \
  litellm --config /tmp/azure_ai_cost_proof.yaml --port 4000

for m in gpt-6.2-astra gpt-6.2-sol gpt-image-2.5-flare gpt-image-2.5-sunburst MAI-Image-2.7 MAI-Image-2.7-Flash MAI-Code-2-Flash; do
  echo "== $m"
  curl -s "http://localhost:4000/utils/model_info?model=azure_ai/$m" \
    -H "Authorization: Bearer $LITELLM_MASTER_KEY" -w '\nHTTP %{http_code}\n'
done

Before (f409bfd)

gpt-6.2 and gpt-image-2.5 resolve to the bare OpenAI rows

gpt-6.2-astra       provider=openai mode=chat             in_tok=8e-06 out_tok=4e-05 successor=None deprecation=None
gpt-6.2-sol         provider=openai mode=chat             in_tok=2e-06 out_tok=1e-05 successor=None deprecation=None
gpt-image-2.5-flare provider=openai mode=image_generation in_tok=5e-06 in_img=8e-06 out_img=3e-05
gpt-image-2.5-sunburst provider=openai mode=image_generation in_tok=5e-06 in_img=8e-06 out_img=3e-05

MAI-Image-2.7 and MAI-Code-2-Flash are not in the cost map

== azure_ai/MAI-Image-2.7
{"detail":{"error":"model=azure_ai/MAI-Image-2.7, custom_llm_provider=None is not in the model cost map"}}
HTTP 404
== azure_ai/MAI-Image-2.7-Flash
{"detail":{"error":"model=azure_ai/MAI-Image-2.7-Flash, custom_llm_provider=None is not in the model cost map"}}
HTTP 404
== azure_ai/MAI-Code-2-Flash
{"detail":{"error":"model=azure_ai/MAI-Code-2-Flash, custom_llm_provider=None is not in the model cost map"}}
HTTP 404

After (076701f)

gpt-6.2 and gpt-image-2.5 resolve to their azure_ai rows

azure_ai/gpt-6.2-astra   provider=azure_ai mode=chat             in_tok=8e-06 out_tok=4e-05 successor=azure_ai/gpt-6-astra deprecation=2027-02-17
azure_ai/gpt-6.2-sol     provider=azure_ai mode=chat             in_tok=2e-06 out_tok=1e-05 successor=azure_ai/gpt-6.1-sol deprecation=2027-11-17
azure_ai/gpt-image-2.5-flare   provider=azure_ai mode=image_generation in_tok=5e-06 in_img=8e-06 out_img=3e-05
azure_ai/gpt-image-2.5-sunburst provider=azure_ai mode=image_generation in_tok=5e-06 in_img=8e-06 out_img=3e-05

MAI-Image-2.7 and MAI-Code-2-Flash resolve to their new rows

azure_ai/MAI-Image-2.7       provider=azure_ai mode=image_generation in_tok=5e-06 in_img=8e-06 out_img=3.4e-05 max_in=32000 HTTP 200
azure_ai/MAI-Image-2.7-Flash provider=azure_ai mode=image_generation in_tok=1.75e-06 in_img=2.5e-06 out_img=1e-05 max_in=32000 HTTP 200
azure_ai/MAI-Code-2-Flash    provider=azure_ai mode=chat in_tok=5e-05 out_tok=0.00025 cache_read=1e-05 max_in=1000000 max_out=128000 HTTP 200

Prices for the gpt rows are unchanged between the legs because the azure twins carry the same rates Foundry bills today; the explicit rows keep the provider, key, and retirement metadata

MAI-Code-2-Flash billing correction (a5d765b)

The Global inference meters list $0.05 per million uncached input tokens, $0.005 per million cached input tokens and $0.25 per million output tokens. Both cost maps use the matching per-token rates. Azure retail meters

With one million input and one million output tokens, the billing regression on 076701f returned $50 input and $250 output, or $10 input when fully cached. At a5d765b it returns $0.05 input and $0.25 output, or $0.005 input when fully cached. A live GET /utils/model_info?model=azure_ai/MAI-Code-2-Flash at this tip returned HTTP 200 with input_cost_per_token=5e-08, cache_read_input_token_cost=5e-09 and output_cost_per_token=2.5e-07. Both regression cases failed on the original rates. All 16 focused tests passed after the correction.

python -m pytest tests/unit/test_model_prices_and_context_window.py -q -k 'mai_code_flash or azure_ai_mai_rows or azure_ai_rows_price'

Type

Infrastructure

Caveats (if any)

Low

  • No live Foundry generation call, the models are not deployable in my subscription
  • gpt prices equal the azure twins today, so that part is a registry correction with no spend change
  • MAI-Voice and MAI-Transcribe ship through Azure Speech, not Foundry Models, so they are out of scope

Note

Low Risk
Data-only cost-map and test updates; no runtime routing or auth changes, though incorrect rates would affect billing accuracy for these models.

Overview
Adds seven explicit azure_ai/ entries to both model_prices_and_context_window.json and its backup so Foundry deployments resolve with the correct provider, pricing, and lifecycle metadata instead of falling through to bare OpenAI keys or 404.

Chat / image twins: gpt-6.2-astra, gpt-6.2-sol, gpt-image-2.5-flare, and gpt-image-2.5-sunburst mirror their existing azure/ rate fields and add Foundry-specific details (e.g. successor_model, deprecation_date, capability flags).

MAI models: New rows for MAI-Image-2.7, MAI-Image-2.7-Flash, and MAI-Code-2-Flash with image- or chat-mode token rates sourced from Azure retail meters.

Tests: Unit coverage asserts azure_ai pricing matches azure twins for the GPT rows, MAI rows have positive mode-appropriate costs, and MAI-Code-2-Flash bills $0.05/$0.005 per million uncached/cached input and $0.25 per million output via cost_per_token.

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

@veria-ai

veria-ai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

No security issues were found in this pull request.

Reviews

Bytechoreographer and others added 2 commits November 23, 2026 19:01
Add explicit azure_ai rows for gpt-6.2-astra, gpt-6.2-sol, gpt-image-2.5-flare, and gpt-image-2.5-sunburst, priced like their azure twins. The lookup previously fell back to the bare OpenAI rows, so model info reported the OpenAI key and provider and dropped the Foundry retirement metadata.

Co-Authored-By: AaronHowell <111272993+AaronHowell@users.noreply.github.com>
Add azure_ai rows for the MAI-Image-2.7 pair and MAI-Code-2-Flash, using the eastus Foundry retail prices and the catalog context windows.

Co-Authored-By: AaronHowell <111272993+AaronHowell@users.noreply.github.com>
@Bytechoreographer
Bytechoreographer force-pushed the litellm_azure_ai_gpt62_gptimage25 branch from 79013e9 to 076701f Compare November 23, 2026 11:05
@Bytechoreographer Bytechoreographer changed the title feat(azure_ai): add Foundry gpt-6.2 and gpt-image-2.5 cost rows feat(azure_ai): add Foundry gpt-6.2, gpt-image-2.5, and MAI cost rows Nov 23, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

The two MAI-Image-2.7 rows from this PR are now in #53569. The GPT-6.2, GPT Image 2.5 and MAI-Code-2-Flash rates are not yet verifiable, so this stays open

@jesus-berri

Copy link
Copy Markdown
Contributor

@greptileai

@jesus-berri

Copy link
Copy Markdown
Contributor

bugbot run

@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect model lookups and cost estimates for seven Azure AI model names.

The required live billing proof must be supplied before merging.

Findings

  1. P2 Live billing proof is missing ▶

Summary

Adds seven azure_ai/ model rows to both cost maps.

  • GPT-6.2 and GPT Image 2.5 lookups return Azure AI rows.
  • MAI image and code lookups return their Foundry pricing rows.

Reviews (2) · Last reviewed commit: "fix(azure_ai): correct MAI-Code-2-Flash ..." · Reviewed by Greptile

Comment on lines +73204 to +73209
"input_cost_per_image_token": 8e-06,
"input_cost_per_token": 5e-06,
"litellm_provider": "azure_ai",
"max_input_tokens": 32000,
"mode": "image_generation",
"output_cost_per_image_token": 3.4e-05,

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.

P2 Live billing proof is missing

These rows add billable rates, but proof at 076701f850a458cb9c5d88a049448e1b6ffd3335 checks only lookups. AGENTS.md requires provider-backed before/after billing checks before merging.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@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.

Stale Bugbot comment from a previous run.

Comment thread model_prices_and_context_window.json Resolved
@jesus-berri

Copy link
Copy Markdown
Contributor

bugbot run

@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 a5d765b. Configure here.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Superseded by the rolling registry PR #53569, which absorbed the four Foundry rows verified against Azure's pricing and Foundry docs. The unverified MAI limits, flags and retirement fields were dropped, see that PR's description.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants