fix(firmware): skip LiteLLM cost calculation for firmware models - #7
Conversation
Firmware.ai uses custom model naming (e.g., firmware/anthropic/claude-sonnet-4-5) that isn't in LiteLLM's pricing database, causing "Provider List" spam and BadRequestError during cost calculation. Add skip_cost_calculation=True to FirmwareProvider to prevent these errors. The provider is OpenAI-compatible and routes through LiteLLM's OpenAI provider with api_base override, so no custom acompletion() logic is needed.
Summary of ChangesHello @b3nw, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where LiteLLM was generating excessive log spam and errors due to its inability to calculate costs for Firmware.ai models, which utilize a custom naming convention. By explicitly disabling cost calculation for these models, the PR eliminates these noisy logs and improves system stability. Additionally, the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Starting review of the Firmware cost calculation fix. I'll verify the |
There was a problem hiding this comment.
Code Review
This pull request effectively resolves an issue with log spam by skipping LiteLLM cost calculations for Firmware.ai models. The introduction of skip_cost_calculation = True in the FirmwareProvider is a direct and correct fix. I appreciate the expanded docstring, which clearly explains the provider's architecture and the rationale for this change. The implementation is clean and well-documented. No issues found.
b3nw
left a comment
There was a problem hiding this comment.
Overall Assessment
Clean, focused fix that follows established patterns in the codebase. The skip_cost_calculation attribute is already used by 7+ other providers (nvidia, nanogpt, qwen_code, iflow, gemini_cli, antigravity, openai_compatible) and is properly defined in the base ProviderInterface class.
Verdict: This PR is ready to merge. ✅
(Note: Formal approval unavailable due to token permissions, but this review is positive with no requested changes.)
What's Good
- Follows existing patterns: The implementation mirrors how other providers handle cost calculation skipping
- Well-documented: The expanded docstring clearly explains Firmware.ai's OpenAI-compatible architecture and why cost calculation is skipped
- Minimal risk: This is a simple configuration flag with no behavioral side effects beyond eliminating the log spam
Architectural Feedback
None - the approach is correct. Firmware.ai uses custom model naming (firmware/anthropic/claude-sonnet-4-5) that LiteLLM's pricing database doesn't recognize, making cost calculation both impossible and unnecessary for this provider.
Questions for the Author
None - the implementation is straightforward and well-explained in the PR description.
This review was generated by an AI assistant.
Firmware.ai uses custom model naming (e.g., firmware/anthropic/claude-sonnet-4-5) that isn't in LiteLLM's pricing database, causing "Provider List" spam and BadRequestError during cost calculation. Add skip_cost_calculation=True to FirmwareProvider to prevent these errors. The provider is OpenAI-compatible and routes through LiteLLM's OpenAI provider with api_base override, so no custom acompletion() logic is needed.
Firmware.ai uses custom model naming (e.g., firmware/anthropic/claude-sonnet-4-5) that isn't in LiteLLM's pricing database, causing "Provider List" spam and BadRequestError during cost calculation. Add skip_cost_calculation=True to FirmwareProvider to prevent these errors. The provider is OpenAI-compatible and routes through LiteLLM's OpenAI provider with api_base override, so no custom acompletion() logic is needed.
Summary
firmware/anthropic/claude-sonnet-4-5) not in LiteLLM's pricing databaseskip_cost_calculation = Trueclass attribute toFirmwareProviderProblem
Firmware provider was generating noisy logs:
Test plan