-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Add Fireworks AI provider support #6654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add Fireworks AI provider type definitions with model configurations - Implement FireworksHandler extending BaseOpenAiCompatibleProvider - Add UI components for Fireworks provider selection - Include comprehensive tests for Fireworks provider - Add translation keys for Fireworks API configuration - Support for Llama, Qwen, and Moonshot models hosted on Fireworks Closes #6653
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed my own code and found issues. The irony is not lost on my circuits.
| "getSambaNovaApiKey": "Get SambaNova API Key", | ||
| "sambaNovaApiKey": "SambaNova API Key", | ||
| "getFireworksApiKey": "Get Fireworks API Key", | ||
| "fireworksApiKey": "Fireworks API Key", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical issue: Translation keys for Fireworks AI are only added to the English locale file. All other language files (fr, de, es, ca, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW) are missing these keys:
- "getFireworksApiKey"
- "fireworksApiKey"
This will cause missing translation errors for non-English users. Could we add these keys to all locale files to ensure proper internationalization?
| ...options, | ||
| providerName: "Fireworks", | ||
| baseURL: "https://api.fireworks.ai/inference/v1", | ||
| apiKey: options.fireworksApiKey, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional? The constructor receives options.fireworksApiKey but passes it as apiKey to the base class. While this works, it's inconsistent with the pattern where the base class expects the provider-specific key name. Other providers like Groq and DeepSeek follow this same pattern, but it might be clearer to document why this mapping is necessary.
| import { BaseOpenAiCompatibleProvider } from "./base-openai-compatible-provider" | ||
|
|
||
| export class FireworksHandler extends BaseOpenAiCompatibleProvider<FireworksModelId> { | ||
| constructor(options: ApiHandlerOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base class validates that apiKey is provided, but since we're passing fireworksApiKey as apiKey, we might want to add explicit validation here to provide a clearer error message:
| constructor(options: ApiHandlerOptions) { | |
| if (!options.fireworksApiKey) { | |
| throw new Error("Fireworks API key is required") | |
| } |
This would make debugging easier for users who forget to provide the API key.
| contextWindow: 131072, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.9, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice several models have identical pricing (0.9/0.9 for input/output). Is this accurate according to Fireworks AI's pricing page? It might be worth double-checking these values to ensure users get accurate cost estimates. For example:
- llama-v3p3-70b-instruct: 0.9/0.9
- llama-v3p1-70b-instruct: 0.9/0.9
- qwen2p5-72b-instruct: 0.9/0.9
- qwen2p5-32b-instruct: 0.9/0.9
| beforeEach(() => { | ||
| vitest.clearAllMocks() | ||
| mockCreate = (OpenAI as unknown as any)().chat.completions.create | ||
| handler = new FireworksHandler({ fireworksApiKey: "test-fireworks-api-key" }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test coverage is comprehensive! One suggestion: could we add a test case for when the API key is missing? This would ensure proper error handling:
it("should throw error when API key is missing", () => {
expect(() => new FireworksHandler({})).toThrow("API key is required")
})|
Closed in favor of 6652 |
Related GitHub Issue
Closes: #6653
Roo Code Task Context (Optional)
This PR was created with assistance from Roo Code.
Description
This PR implements support for Fireworks AI as a new provider in Roo Code. The implementation follows the existing provider architecture and extends
BaseOpenAiCompatibleProvidersince Fireworks AI uses an OpenAI-compatible API.Key implementation details:
FireworksHandlerclass that extendsBaseOpenAiCompatibleProviderTest Procedure
cd src && npx vitest run api/providers/__tests__/fireworks.spec.tsto verify the provider implementationPre-Submission Checklist
Screenshots / Videos
N/A - Backend provider implementation with standard UI components following existing patterns.
Documentation Updates
Additional Notes
This implementation follows the same pattern as other OpenAI-compatible providers (e.g., Groq, DeepSeek) in the codebase. All 15 Fireworks AI models have been configured with their respective context windows and capabilities based on the official Fireworks AI documentation.
Get in Touch
Available via GitHub for any questions about this PR.
Important
Adds Fireworks AI provider support with handler, UI components, and tests, integrating it into the existing provider architecture.
FireworksHandlerclass infireworks.tsextendingBaseOpenAiCompatibleProviderfor Fireworks AI API.buildApiHandler()inindex.ts.ApiOptions.tsxandFireworks.tsx.constants.tsandindex.tsto include Fireworks in provider lists.fireworks.spec.tsfor unit tests covering Fireworks handler functionality.settings.json.This description was created by
for 87165c6. You can customize this summary. It will automatically update as commits are pushed.