Skip to content

fix(pricing): remove gpt-image-2 text output cost - #32754

Closed
gorquan wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
gorquan:fix-gpt-image-2-text-output-price
Closed

fix(pricing): remove gpt-image-2 text output cost#32754
gorquan wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
gorquan:fix-gpt-image-2-text-output-price

Conversation

@gorquan

@gorquan gorquan commented Jul 10, 2026

Copy link
Copy Markdown

Relevant issues

Related to #31142, closed unmerged #26865, and open #27064

PR #26865 already noted that GPT Image 2 has no text output rate, but it was closed without merging after #26644 added the current entries. PR #27064 applies the same omission to separate azure_ai/... aliases and does not update these existing OpenAI and Azure entries

Linear ticket

Pre-Submission checklist

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

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • 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 UI change

OpenAI lists GPT Image 2 text output as - while image output remains $30 per 1M tokens, and the model page lists image as its only output modality. Microsoft likewise states there is no billing for GPT Image 2 text output tokens

Sources: OpenAI pricing, OpenAI model, Microsoft Foundry announcement

Before at bf02a4a47f08ad8007a24c8da2ffa8de1a1d36a2:

gpt-image-2: text=0.00001, image=0.00003
gpt-image-2-2026-04-21: text=0.00001, image=0.00003
azure/gpt-image-2: text=0.00001, image=0.00003
azure/gpt-image-2-2026-04-21: text=0.00001, image=0.00003

After at 89f54feccafb10c990b90d60a3271ce0185bdc77:

gpt-image-2: text=absent, image=0.00003
gpt-image-2-2026-04-21: text=absent, image=0.00003
azure/gpt-image-2: text=absent, image=0.00003
azure/gpt-image-2-2026-04-21: text=absent, image=0.00003

Type

Bug Fix

Changes

Remove the unsupported output_cost_per_token field from the canonical and dated GPT Image 2 entries for OpenAI and Azure in both cost maps

Update model metadata and cost calculator regression tests so image output remains billed at output_cost_per_image_token and raw cost maps cannot reintroduce a text output rate

@CLAassistant

CLAassistant commented Jul 10, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Removes the erroneous output_cost_per_token field from the four gpt-image-2 entries (canonical + Azure variants) in both cost-map files, aligning with OpenAI and Microsoft's published pricing where text output is not billed. Tests are updated to reflect the corrected expectation.

  • The JSON deletions are precise and consistent across both model_prices_and_context_window.json and the backup; output_cost_per_image_token (3e-5) is preserved.
  • The cost-calculator fallback in _get_token_base_cost (lines 222–227 of utils.py) already handles the case where output_cost_per_token is 0 by substituting output_cost_per_image_token, so the renamed "uses_image_rate" test correctly describes the resulting behavior.
  • A new raw-JSON regression test (test_gpt_image_2_cost_maps_have_no_text_output_price) ensures neither cost map can silently reintroduce a text-output price for these models.

Confidence Score: 5/5

Safe to merge — the change removes a billing field that should never have existed; no logic is altered beyond the cost-map data.

The deletions are narrow, factually correct per upstream pricing documentation, and mirrored consistently across both JSON files. The _get_token_base_cost fallback (output_cost_per_image_token when output_cost_per_token is 0) was already in place, so the cost calculator behaves correctly without any code changes. The updated and newly added tests accurately describe the post-fix behavior and would catch any re-introduction of the text-output price.

No files require special attention.

Important Files Changed

Filename Overview
model_prices_and_context_window.json Removes incorrect output_cost_per_token from gpt-image-2 and gpt-image-2-2026-04-21 (both OpenAI and azure/ entries); image output rate preserved at 3e-5
litellm/model_prices_and_context_window_backup.json Mirror of the main cost map change — same four entries corrected; backup stays in sync with canonical file
tests/test_litellm/test_utils.py Updates three existing assertions from output_cost_per_token == 1e-05 to == 0, adds a raw-JSON regression test; the == 0 assertion is valid because get_model_info defaults the missing field to 0
tests/test_litellm/test_gpt_image_cost_calculator.py Removes text-token parameters from breakdown test and updates fallback-path test to expect image rate (3e-5); both changes are consistent with the _get_token_base_cost fallback that uses output_cost_per_image_token when output_cost_per_token is 0

Reviews (1): Last reviewed commit: "fix(pricing): remove gpt-image-2 text ou..." | Re-trigger Greptile

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing gorquan:fix-gpt-image-2-text-output-price (9acf527) with litellm_internal_staging (3e9e520)

Open in CodSpeed

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Superseded: the gpt-image-2 output_cost_per_token removal is already on litellm_internal_staging. Registry work continues in rolling PR #31884.

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