Skip to content

Commit 618d907

Browse files
fix(fal_ai): price gpt-image-2 unprefixed alias and edit endpoint
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent f3896c0 commit 618d907

3 files changed

Lines changed: 62 additions & 2 deletions

File tree

litellm/model_prices_and_context_window_backup.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17410,6 +17410,32 @@
1741017410
],
1741117411
"supports_vision": true
1741217412
},
17413+
"fal_ai/gpt-image-2": {
17414+
"litellm_provider": "fal_ai",
17415+
"metadata": {
17416+
"notes": "Alias of fal_ai/openai/gpt-image-2, which litellm also accepts without the openai/ prefix. Same rate, see that entry for the size and quality caveat"
17417+
},
17418+
"mode": "image_generation",
17419+
"output_cost_per_image": 0.145,
17420+
"source": "https://fal.ai/models/openai/gpt-image-2",
17421+
"supported_endpoints": [
17422+
"/v1/images/generations"
17423+
],
17424+
"supports_vision": true
17425+
},
17426+
"fal_ai/openai/gpt-image-2/edit": {
17427+
"litellm_provider": "fal_ai",
17428+
"metadata": {
17429+
"notes": "Editing endpoint of gpt-image-2 on fal.ai. Same rate as fal_ai/openai/gpt-image-2, see that entry for the size and quality caveat"
17430+
},
17431+
"mode": "image_generation",
17432+
"output_cost_per_image": 0.145,
17433+
"source": "https://fal.ai/models/openai/gpt-image-2/edit",
17434+
"supported_endpoints": [
17435+
"/v1/images/edits"
17436+
],
17437+
"supports_vision": true
17438+
},
1741317439
"featherless_ai/featherless-ai/Qwerky-72B": {
1741417440
"litellm_provider": "featherless_ai",
1741517441
"max_input_tokens": 32768,

model_prices_and_context_window.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17410,6 +17410,32 @@
1741017410
],
1741117411
"supports_vision": true
1741217412
},
17413+
"fal_ai/gpt-image-2": {
17414+
"litellm_provider": "fal_ai",
17415+
"metadata": {
17416+
"notes": "Alias of fal_ai/openai/gpt-image-2, which litellm also accepts without the openai/ prefix. Same rate, see that entry for the size and quality caveat"
17417+
},
17418+
"mode": "image_generation",
17419+
"output_cost_per_image": 0.145,
17420+
"source": "https://fal.ai/models/openai/gpt-image-2",
17421+
"supported_endpoints": [
17422+
"/v1/images/generations"
17423+
],
17424+
"supports_vision": true
17425+
},
17426+
"fal_ai/openai/gpt-image-2/edit": {
17427+
"litellm_provider": "fal_ai",
17428+
"metadata": {
17429+
"notes": "Editing endpoint of gpt-image-2 on fal.ai. Same rate as fal_ai/openai/gpt-image-2, see that entry for the size and quality caveat"
17430+
},
17431+
"mode": "image_generation",
17432+
"output_cost_per_image": 0.145,
17433+
"source": "https://fal.ai/models/openai/gpt-image-2/edit",
17434+
"supported_endpoints": [
17435+
"/v1/images/edits"
17436+
],
17437+
"supports_vision": true
17438+
},
1741317439
"featherless_ai/featherless-ai/Qwerky-72B": {
1741417440
"litellm_provider": "featherless_ai",
1741517441
"max_input_tokens": 32768,

tests/test_litellm/llms/fal_ai/image_generation/test_fal_ai_gpt_image_2_transformation.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,20 @@ def test_transform_image_generation_request():
127127
) == {"prompt": "a red bicycle", "quality": "high", "num_images": 2}
128128

129129

130-
def test_cost_calculator_uses_registry_price(monkeypatch: pytest.MonkeyPatch):
130+
@pytest.mark.parametrize(
131+
"model",
132+
[
133+
"openai/gpt-image-2",
134+
"gpt-image-2",
135+
"openai/gpt-image-2/edit",
136+
],
137+
)
138+
def test_cost_calculator_uses_registry_price(model, monkeypatch: pytest.MonkeyPatch):
131139
monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url=""))
132140
response = ImageResponse(
133141
data=[
134142
ImageObject(url="https://v3b.fal.media/files/b/one.png"),
135143
ImageObject(url="https://v3b.fal.media/files/b/two.png"),
136144
]
137145
)
138-
assert cost_calculator(model="openai/gpt-image-2", image_response=response) == pytest.approx(0.29)
146+
assert cost_calculator(model=model, image_response=response) == pytest.approx(0.29)

0 commit comments

Comments
 (0)