Skip to content

feat(pricing): add gpt-image-2 and azure_ai/gpt-image-2 model pricing - #26866

Closed
xodn348 wants to merge 1 commit into
BerriAI:mainfrom
xodn348:fix/add-azure-ai-gpt-image-2-pricing
Closed

xodn348 wants to merge 1 commit into
BerriAI:mainfrom
xodn348:fix/add-azure-ai-gpt-image-2-pricing

Conversation

@xodn348

@xodn348 xodn348 commented Apr 30, 2026

Copy link
Copy Markdown

Summary

Adds pricing entries for OpenAI's gpt-image-2 model and its Azure AI Foundry (azure_ai/gpt-image-2) variant to both model_prices_and_context_window.json and litellm/model_prices_and_context_window_backup.json.

Pricing values sourced from https://platform.openai.com/docs/models/gpt-image-2 and https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/:

Field Value
input_cost_per_token (text) 5e-06 ($5.00 / 1M tokens)
cache_read_input_token_cost 1.25e-06 ($1.25 / 1M tokens)
input_cost_per_image_token 8e-06 ($8.00 / 1M image tokens)
cache_read_input_image_token_cost 2e-06 ($2.00 / 1M image tokens)
output_cost_per_image_token 3e-05 ($30.00 / 1M image tokens)

Both openai and azure_ai providers support /v1/images/generations and /v1/images/edits endpoints.

Closes #26765
Relates to #26863 (gpt-image-2 cost always 0 — this adds the missing cost entry)

Test plan

  • Both JSON files parse as valid JSON (python3 -c "import json; json.load(open(...))")
  • Pricing values match the official OpenAI API pricing page for gpt-image-2
  • Entry format mirrors existing gpt-image-1 / azure/gpt-image-1 structure

Add cost entries for OpenAI's gpt-image-2 model and its Azure AI Foundry
variant to both pricing JSON files:
- input_cost_per_token: $5/1M (5e-06)
- cache_read_input_token_cost: $1.25/1M (1.25e-06)
- input_cost_per_image_token: $8/1M (8e-06)
- cache_read_input_image_token_cost: $2/1M (2e-06)
- output_cost_per_image_token: $30/1M (3e-05)

Fixes #26765, relates to #26863
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds pricing entries for gpt-image-2 (openai provider) and azure_ai/gpt-image-2 (Azure AI Foundry) to both pricing JSON files. All five cost fields have been verified against OpenAI's official API pricing page and are accurate: input_cost_per_token ($5.00/1M), cache_read_input_token_cost ($1.25/1M), input_cost_per_image_token ($8.00/1M), cache_read_input_image_token_cost ($2.00/1M), and output_cost_per_image_token ($30.00/1M). Entry structure mirrors the existing gpt-image-1 pattern and both JSON files are kept in sync.

Confidence Score: 5/5

Safe to merge — JSON-only pricing addition with values confirmed against OpenAI's official pricing page

All pricing values are verified correct, structure matches existing image generation model entries, both files are kept in sync, and no logic/code changes are involved

No files require special attention

Important Files Changed

Filename Overview
model_prices_and_context_window.json Adds gpt-image-2 (openai) and azure_ai/gpt-image-2 pricing entries with correct token costs verified against OpenAI's official pricing page
litellm/model_prices_and_context_window_backup.json Identical entries added as in the primary JSON; backup kept in sync correctly

Reviews (1): Last reviewed commit: "feat(pricing): add gpt-image-2 and azure..." | Re-trigger Greptile

@codspeed

codspeed Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing xodn348:fix/add-azure-ai-gpt-image-2-pricing (02d1ef3) with main (3e1479c)

Open in CodSpeed

@codecov

codecov Bot commented Apr 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Technotraxx

Copy link
Copy Markdown

Thanks for putting this together! Two notes from production usage of gpt-image-2 on LiteLLM v1.82.3:

1. Missing azure/gpt-image-2 (Azure OpenAI Service)

This PR adds openai/gpt-image-2 and azure_ai/gpt-image-2 (Azure AI Foundry), but not azure/gpt-image-2 (Azure OpenAI Service, litellm_provider: "azure"). These are different routing paths in LiteLLM, and Azure OpenAI Service is the more common deployment for enterprise users who provisioned gpt-image-2 directly through their Azure OpenAI resource (not via AI Foundry).

Concrete impact: in our setup (azure/gpt-image-2, Sweden Central, 177 successful image generation requests, 75,934 reported tokens), the LiteLLM dashboard shows $0.00 spend — reproducing #26863. Adding the azure/ variant alongside azure_ai/ would close that gap.

2. Please apply the same fix as #27064 (remove output_cost_per_token)

Greptile already flagged this above: setting output_cost_per_token: 1e-05 causes the cost calculator to skip the image-token fallback path, which is the actual root cause of #26863 (gpt-image-2 emits zero text-output tokens, so the calculation collapses to $0). PR #27064 explicitly removes output_cost_per_token and supports_pdf_input, and adds a test guard:

assert info.get("output_cost_per_token") is None
assert info.get("supports_pdf_input") is None

Aligning #26866 with the same shape (and with the existing gpt-image-1 pattern) would make this PR mergeable without regressing the cost calculation. Otherwise both PRs end up partially correct: yours covers more providers, #27064 has the correct field set.

Suggested entries to add/adjust:

  • azure/gpt-image-2 (Azure OpenAI Service)
  • azure_ai/gpt-image-2 — remove output_cost_per_token, remove supports_pdf_input
  • gpt-image-2 (openai) — same cleanup

Happy to verify against our deployment once merged. Thanks again!

@oss-pr-review-agent-shin

Copy link
Copy Markdown
Contributor

🤖 litellm-agent: This PR is currently BLOCKED from merge.

Score: 4/5

Why blocked:

  • 2 unresolved reviewer concerns (unknown, unknown) (unresolved_concern, -1 pts)

Details: Score docked for: 2 unresolved reviewer concerns (unknown, unknown).

Fix the issues above and push an update — the bot will re-review automatically.

Note: This bot is still in beta and might not always work as expected. Please share any feedback via Slack.

@oss-pr-review-agent-shin

Copy link
Copy Markdown
Contributor

🤖 litellm-agent: This PR was marked BLOCKED 7 days ago with no subsequent activity. Closing automatically.

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.

3 participants