Files
litellm/tests
Cesar GarciaandGitHub c8950a5ba2 fix(cost_calculator): correct gpt-image-1 cost calculation using token-based pricing (#17906)
* fix(cost_calculator): correct gpt-image-1 cost calculation using token-based pricing (#13847)

gpt-image-1 uses token-based pricing (like chat models), not pixel-based pricing
like DALL-E. The old code was calculating incorrect costs by treating it as DALL-E.

Changes:
- Update model pricing JSON with correct token-based costs for gpt-image-1
- Add dedicated cost calculator for OpenAI gpt-image models
- Route gpt-image-1 to token-based calculator in cost router
- Add comprehensive tests for the new calculator

* refactor: simplify gpt-image-1 cost calculator using responses API helper

Reuse _transform_response_api_usage_to_chat_usage and generic_cost_per_token
for gpt-image-1 cost calculation since ImageUsage has the same spec as
ResponseAPIUsage.
2026-01-02 23:08:52 +05:30
..
2026-01-02 17:38:52 +09:00

In total litellm runs 1000+ tests

[02/20/2025] Update:

To make it easier to contribute and map what behavior is tested,

we've started mapping the litellm directory in tests/test_litellm

This folder can only run mock tests.