litellm - ✅(Solved) Fix [Bug]: support gpt-image-2 [1 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#26232Fetched 2026-04-23 07:24:33
View on GitHub
Comments
2
Participants
3
Timeline
14
Reactions
4
Timeline (top)
subscribed ×7labeled ×3commented ×2mentioned ×2

PR fix notes

PR #26331: feat(openai): add gpt-image-2 to model prices

Description (problem / solution / changelog)

What does this PR do?

Adds gpt-image-2 to the model prices and context window registry.

gpt-image-2 was released on 2026-04-21 and is available in the OpenAI API and Codex. It was missing from litellm's model cost map, causing litellm.get_model_info("gpt-image-2") to return None and cost calculation to fail.

Pricing (from https://openai.com/api/pricing/)

Token-based billing:

  • Image input: $8.00 / 1M tokens
  • Image output: $32.00 / 1M tokens

Per-image pricing at 1024×1024:

  • Low quality: $0.006
  • Medium quality: $0.053
  • High quality: $0.211

Changes

  • Added gpt-image-2 base entry with token-based pricing to model_prices_and_context_window_backup.json
  • Added low/medium/high per-quality entries for 1024×1024 resolution
  • Added 3 unit tests in TestGPTImage2CostCalculator

Tests

LITELLM_LOCAL_MODEL_COST_MAP=True pytest tests/test_litellm/test_gpt_image_cost_calculator.py -q
# 11 passed

Closes #26232

Relates to litellm_oss_branch

Changed files

  • litellm/litellm_core_utils/llm_cost_calc/utils.py (modified, +2/-2)
  • litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py (modified, +4/-1)
  • litellm/model_prices_and_context_window_backup.json (modified, +93/-1)
  • model_prices_and_context_window.json (modified, +93/-1)
  • tests/test_litellm/llms/anthropic/experimental_pass_through/responses_adapters/test_responses_adapters_transformation.py (modified, +48/-1)
  • tests/test_litellm/test_gpt_image_cost_calculator.py (modified, +66/-0)
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

new image model from openAi : https://developers.openai.com/api/docs/models/gpt-image-2

Steps to Reproduce

  1. not declared in litellm

Relevant log output

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

last version ig github

Twitter / LinkedIn details

No response

extent analysis

TL;DR

  • The issue may be resolved by updating the LiteLLM configuration to include the new GPT-Image-2 model from OpenAI.

Guidance

  • Check the LiteLLM documentation for instructions on how to add new models, specifically the GPT-Image-2 model.
  • Verify that the OpenAI API is properly configured and authenticated in LiteLLM.
  • Review the LiteLLM proxy settings to ensure they are compatible with the new model.

Notes

  • The issue lacks specific error messages or log output, making it difficult to provide a more detailed solution.
  • The user is on the latest version of LiteLLM from GitHub, which may indicate that the issue is not due to an outdated version.

Recommendation

  • Apply workaround: Update the LiteLLM configuration to include the new GPT-Image-2 model, as this is the most likely cause of the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING