From dc54b16d3c84c87835d365e193c6f029dbe6aa81 Mon Sep 17 00:00:00 2001 From: Bruno Felthes Date: Mon, 17 Aug 2026 21:43:24 -0300 Subject: [PATCH 1/2] fix(fireworks): skip accounts/ rewrite for FW-* Foundry deployment ids resolve_fireworks_resource_name prefixes bare names with accounts/fireworks/models/ (or routers/ for *-fast). Azure AI Foundry hosts Fireworks models under deployment ids like FW-Kimi-K3; rewriting those yields 404 DeploymentNotFound. Leave names that already start with FW- unchanged. Native Fireworks short names still get the accounts/ path. Co-authored-by: Cursor --- litellm/llms/fireworks_ai/common_utils.py | 5 +++++ .../llms/fireworks_ai/test_fireworks_ai_common_utils.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/litellm/llms/fireworks_ai/common_utils.py b/litellm/llms/fireworks_ai/common_utils.py index e07e7a26f9e..522c955770c 100644 --- a/litellm/llms/fireworks_ai/common_utils.py +++ b/litellm/llms/fireworks_ai/common_utils.py @@ -33,6 +33,11 @@ def resolve_fireworks_resource_name(model: str) -> str: stripped: Final = model.removeprefix("fireworks_ai/") if stripped.startswith("accounts/") or "#" in stripped: return stripped + # Azure AI Foundry (and similar OpenAI-compat hosts) expose Fireworks + # deployments as ids like ``FW-Kimi-K3``. Rewriting those to + # ``accounts/fireworks/models/FW-…`` yields DeploymentNotFound. + if stripped.startswith("FW-"): + return stripped if stripped.startswith(("routers/", "models/")): return f"accounts/fireworks/{stripped}" if stripped.endswith("-fast"): diff --git a/tests/test_litellm/llms/fireworks_ai/test_fireworks_ai_common_utils.py b/tests/test_litellm/llms/fireworks_ai/test_fireworks_ai_common_utils.py index 4af395baf41..b52c910d5a6 100644 --- a/tests/test_litellm/llms/fireworks_ai/test_fireworks_ai_common_utils.py +++ b/tests/test_litellm/llms/fireworks_ai/test_fireworks_ai_common_utils.py @@ -39,6 +39,9 @@ from litellm.llms.fireworks_ai.common_utils import resolve_fireworks_resource_na "glm-4p6#accounts/gitlab/deployments/2fb7764c", "glm-4p6#accounts/gitlab/deployments/2fb7764c", ), + ("FW-Kimi-K3", "FW-Kimi-K3"), + ("fireworks_ai/FW-Kimi-K3", "FW-Kimi-K3"), + ("FW-GLM-5.2-Fast", "FW-GLM-5.2-Fast"), ], ) def test_resolve_fireworks_resource_name(model, expected): From 8dc8cae0ec1482b635b369484455e52f5237c098 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Tue, 18 Aug 2026 13:17:44 -0700 Subject: [PATCH 2/2] refactor(fireworks): name the Foundry deployment id prefix instead of commenting it --- litellm/llms/fireworks_ai/common_utils.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/litellm/llms/fireworks_ai/common_utils.py b/litellm/llms/fireworks_ai/common_utils.py index 522c955770c..8e35cfebc5b 100644 --- a/litellm/llms/fireworks_ai/common_utils.py +++ b/litellm/llms/fireworks_ai/common_utils.py @@ -29,14 +29,12 @@ def get_fireworks_session_id(litellm_params: dict) -> str | None: return None +AZURE_FOUNDRY_FIREWORKS_MODEL_ID_PREFIX: Final = "FW-" + + def resolve_fireworks_resource_name(model: str) -> str: stripped: Final = model.removeprefix("fireworks_ai/") - if stripped.startswith("accounts/") or "#" in stripped: - return stripped - # Azure AI Foundry (and similar OpenAI-compat hosts) expose Fireworks - # deployments as ids like ``FW-Kimi-K3``. Rewriting those to - # ``accounts/fireworks/models/FW-…`` yields DeploymentNotFound. - if stripped.startswith("FW-"): + if stripped.startswith(("accounts/", AZURE_FOUNDRY_FIREWORKS_MODEL_ID_PREFIX)) or "#" in stripped: return stripped if stripped.startswith(("routers/", "models/")): return f"accounts/fireworks/{stripped}"