Skip to content

fix(fireworks): add glm-5p1 metadata and parallel_tool_calls - #26031

Closed
elonazoulay wants to merge 1 commit into
BerriAI:mainfrom
elonazoulay:codex/fireworks-glm5p1-contrib
Closed

fix(fireworks): add glm-5p1 metadata and parallel_tool_calls#26031
elonazoulay wants to merge 1 commit into
BerriAI:mainfrom
elonazoulay:codex/fireworks-glm5p1-contrib

Conversation

@elonazoulay

@elonazoulay elonazoulay commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Relevant issues

Fixes Fireworks AI provider capability metadata for GLM-5.1 and exposes parallel_tool_calls when tool_choice is supported.

Pre-Submission checklist

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

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Screenshots / Proof of Fix

  • Added fireworks_ai/accounts/fireworks/models/glm-5p1 and fireworks_ai/glm-5p1 entries to the model cost maps.
  • Updated Fireworks chat transformation to include parallel_tool_calls when tool_choice is supported.
  • Reworked Fireworks provider capability lookup to respect explicit model-map capability flags. Models not in the cost map default to supports_function_calling: True — only models with an explicit false entry (like glm-5p1) opt out.
  • Added targeted tests covering GLM-5.1 reasoning metadata, parallel_tool_calls, and get_model_info() capability preservation.

Type

🐛 Bug Fix

Changes

  • add Fireworks GLM-5.1 metadata to both model pricing/context maps
  • expose parallel_tool_calls for Fireworks models that support tool_choice
  • ensure Fireworks provider info respects explicit model-map capability flags
  • add targeted unit coverage for the above behavior

@codspeed-hq

codspeed-hq Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing elonazoulay:codex/fireworks-glm5p1-contrib (f9fe49d) with main (850fe59)

Open in CodSpeed

@greptile-apps

greptile-apps Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds GLM-5.1 model metadata to the Fireworks AI pricing/context maps, exposes parallel_tool_calls for Fireworks models that declare supports_tool_choice, and reworks get_provider_info to use a new _get_model_cost_capability helper so explicit model-map flags (e.g. supports_function_calling: false for GLM-5.1) are respected. The implementation is correct and well-tested.

Confidence Score: 5/5

Safe to merge — changes are additive metadata entries and a well-tested capability-gating improvement with no backwards-incompatible behaviour.

All findings are P2 or lower. The JSON entries are consistent between both pricing files, the _get_model_cost_capability helper correctly handles all model-key prefix variants, the parallel_tool_calls gating logic is sound, and the new tests use only mocks and the local model cost map (no real network calls).

No files require special attention.

Important Files Changed

Filename Overview
litellm/llms/fireworks_ai/chat/transformation.py Adds _get_model_cost_capability helper and updates get_provider_info to respect explicit model-map flags; adds parallel_tool_calls to supported params when supports_tool_choice is true. Logic is sound.
model_prices_and_context_window.json Adds fireworks_ai/accounts/fireworks/models/glm-5p1 and fireworks_ai/glm-5p1 entries with correct pricing, context window, and capability flags (supports_function_calling: false, supports_reasoning: true, supports_tool_choice: false).
litellm/model_prices_and_context_window_backup.json Backup JSON kept in sync with the main pricing file; GLM-5P1 entries are identical to the primary file.
tests/test_litellm/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py Adds targeted unit tests for GLM-5.1 reasoning metadata, parallel_tool_calls gating, get_model_info capability preservation, and an unmapped-model fallback; all tests use mocks/local model cost map and make no real network calls.

Reviews (2): Last reviewed commit: "fix(fireworks): add glm-5p1 metadata and..." | Re-trigger Greptile

@codecov

codecov Bot commented Apr 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.35294% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
litellm/llms/fireworks_ai/chat/transformation.py 82.35% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@elonazoulay
elonazoulay force-pushed the codex/fireworks-glm5p1-contrib branch from ab2b304 to f9fe49d Compare April 18, 2026 22:11

@VANDRANKI VANDRANKI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is directly complementary to #26016 - that PR fixes the cost calculator to apply cache_read_input_token_cost, and this PR adds the glm-5p1 entry to the model map with that field set. The two together make cached token billing correct for glm-5p1 end to end.

The _get_model_cost_capability refactor is cleaner than the hardcoded model list - capability flags now live in the model map where they belong and don't need a code change to add new models.

One thing to check: the original bug report (issue #25950) lists cache_creation_input_token_cost: 2.6e-7 alongside cache_read_input_token_cost, but the new glm-5p1 model map entries only include cache_read_input_token_cost. If GLM-5P1 does charge for cache creation, it's worth adding that field too.

Also: glm-4p7 appears in the test's supported_models list but I don't see a corresponding entry in the model cost map. Worth verifying that lookup won't silently return None and cause the test to pass vacuously.

@elonazoulay

Copy link
Copy Markdown
Contributor Author

superceded by #26069

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