Skip to content

Commit 4a9222b

Browse files
Add the fireworks AI provider (RooCodeInc#6652)
* add fireworks provider * add tests * Update packages/types/src/providers/fireworks.ts Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * fix typo * another typo --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
1 parent 1d714c8 commit 4a9222b

File tree

35 files changed

+560
-0
lines changed

35 files changed

+560
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ body:
2525
- AWS Bedrock
2626
- Chutes AI
2727
- DeepSeek
28+
- Fireworks AI
2829
- Glama
2930
- Google Gemini
3031
- Google Vertex AI

packages/types/src/global-settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ export const SECRET_STATE_KEYS = [
193193
"codebaseIndexMistralApiKey",
194194
"huggingFaceApiKey",
195195
"sambaNovaApiKey",
196+
"fireworksApiKey",
196197
] as const satisfies readonly (keyof ProviderSettings)[]
197198
export type SecretState = Pick<ProviderSettings, (typeof SECRET_STATE_KEYS)[number]>
198199

packages/types/src/provider-settings.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const providerNames = [
3737
"cerebras",
3838
"sambanova",
3939
"zai",
40+
"fireworks",
4041
] as const
4142

4243
export const providerNamesSchema = z.enum(providerNames)
@@ -263,6 +264,10 @@ const zaiSchema = apiModelIdProviderModelSchema.extend({
263264
zaiApiLine: z.union([z.literal("china"), z.literal("international")]).optional(),
264265
})
265266

267+
const fireworksSchema = apiModelIdProviderModelSchema.extend({
268+
fireworksApiKey: z.string().optional(),
269+
})
270+
266271
const defaultSchema = z.object({
267272
apiProvider: z.undefined(),
268273
})
@@ -297,6 +302,7 @@ export const providerSettingsSchemaDiscriminated = z.discriminatedUnion("apiProv
297302
cerebrasSchema.merge(z.object({ apiProvider: z.literal("cerebras") })),
298303
sambaNovaSchema.merge(z.object({ apiProvider: z.literal("sambanova") })),
299304
zaiSchema.merge(z.object({ apiProvider: z.literal("zai") })),
305+
fireworksSchema.merge(z.object({ apiProvider: z.literal("fireworks") })),
300306
defaultSchema,
301307
])
302308

@@ -331,6 +337,7 @@ export const providerSettingsSchema = z.object({
331337
...cerebrasSchema.shape,
332338
...sambaNovaSchema.shape,
333339
...zaiSchema.shape,
340+
...fireworksSchema.shape,
334341
...codebaseIndexProviderSchema.shape,
335342
})
336343

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import type { ModelInfo } from "../model.js"
2+
3+
export type FireworksModelId =
4+
| "accounts/fireworks/models/kimi-k2-instruct"
5+
| "accounts/fireworks/models/qwen3-235b-a22b-instruct-2507"
6+
| "accounts/fireworks/models/qwen3-coder-480b-a35b-instruct"
7+
| "accounts/fireworks/models/deepseek-r1-0528"
8+
| "accounts/fireworks/models/deepseek-v3"
9+
10+
export const fireworksDefaultModelId: FireworksModelId = "accounts/fireworks/models/kimi-k2-instruct"
11+
12+
export const fireworksModels = {
13+
"accounts/fireworks/models/kimi-k2-instruct": {
14+
maxTokens: 16384,
15+
contextWindow: 128000,
16+
supportsImages: false,
17+
supportsPromptCache: false,
18+
inputPrice: 0.6,
19+
outputPrice: 2.5,
20+
description:
21+
"Kimi K2 is a state-of-the-art mixture-of-experts (MoE) language model with 32 billion activated parameters and 1 trillion total parameters. Trained with the Muon optimizer, Kimi K2 achieves exceptional performance across frontier knowledge, reasoning, and coding tasks while being meticulously optimized for agentic capabilities.",
22+
},
23+
"accounts/fireworks/models/qwen3-235b-a22b-instruct-2507": {
24+
maxTokens: 32768,
25+
contextWindow: 256000,
26+
supportsImages: false,
27+
supportsPromptCache: false,
28+
inputPrice: 0.22,
29+
outputPrice: 0.88,
30+
description: "Latest Qwen3 thinking model, competitive against the best closed source models in Jul 2025.",
31+
},
32+
"accounts/fireworks/models/qwen3-coder-480b-a35b-instruct": {
33+
maxTokens: 32768,
34+
contextWindow: 256000,
35+
supportsImages: false,
36+
supportsPromptCache: false,
37+
inputPrice: 0.45,
38+
outputPrice: 1.8,
39+
description: "Qwen3's most agentic code model to date.",
40+
},
41+
"accounts/fireworks/models/deepseek-r1-0528": {
42+
maxTokens: 20480,
43+
contextWindow: 160000,
44+
supportsImages: false,
45+
supportsPromptCache: false,
46+
inputPrice: 3,
47+
outputPrice: 8,
48+
description:
49+
"05/28 updated checkpoint of Deepseek R1. Its overall performance is now approaching that of leading models, such as O3 and Gemini 2.5 Pro. Compared to the previous version, the upgraded model shows significant improvements in handling complex reasoning tasks, and this version also offers a reduced hallucination rate, enhanced support for function calling, and better experience for vibe coding. Note that fine-tuning for this model is only available through contacting fireworks at https://fireworks.ai/company/contact-us.",
50+
},
51+
"accounts/fireworks/models/deepseek-v3": {
52+
maxTokens: 16384,
53+
contextWindow: 128000,
54+
supportsImages: false,
55+
supportsPromptCache: false,
56+
inputPrice: 0.9,
57+
outputPrice: 0.9,
58+
description:
59+
"A strong Mixture-of-Experts (MoE) language model with 671B total parameters with 37B activated for each token from Deepseek. Note that fine-tuning for this model is only available through contacting fireworks at https://fireworks.ai/company/contact-us.",
60+
},
61+
} as const satisfies Record<string, ModelInfo>

packages/types/src/providers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ export * from "./vscode-llm.js"
2323
export * from "./xai.js"
2424
export * from "./doubao.js"
2525
export * from "./zai.js"
26+
export * from "./fireworks.js"

src/api/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
SambaNovaHandler,
3535
DoubaoHandler,
3636
ZAiHandler,
37+
FireworksHandler,
3738
} from "./providers"
3839

3940
export interface SingleCompletionHandler {
@@ -127,6 +128,8 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
127128
return new SambaNovaHandler(options)
128129
case "zai":
129130
return new ZAiHandler(options)
131+
case "fireworks":
132+
return new FireworksHandler(options)
130133
default:
131134
apiProvider satisfies "gemini-cli" | undefined
132135
return new AnthropicHandler(options)

0 commit comments

Comments
 (0)