Skip to content

Commit 5cf78a4

Browse files
committed
feat: add Featherless AI as a provider
- Add Featherless to provider names list - Create Featherless model types with popular models - Implement FeatherlessHandler using OpenAI-compatible API - Add Featherless schema and configuration - Wire up Featherless in API handler Closes #7237
1 parent 613abe0 commit 5cf78a4

File tree

6 files changed

+112
-0
lines changed

6 files changed

+112
-0
lines changed

packages/types/src/provider-settings.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const providerNames = [
4848
"fireworks",
4949
"io-intelligence",
5050
"roo",
51+
"featherless",
5152
] as const
5253

5354
export const providerNamesSchema = z.enum(providerNames)
@@ -293,6 +294,10 @@ const rooSchema = apiModelIdProviderModelSchema.extend({
293294
// No additional fields needed - uses cloud authentication
294295
})
295296

297+
const featherlessSchema = apiModelIdProviderModelSchema.extend({
298+
featherlessApiKey: z.string().optional(),
299+
})
300+
296301
const defaultSchema = z.object({
297302
apiProvider: z.undefined(),
298303
})
@@ -330,6 +335,7 @@ export const providerSettingsSchemaDiscriminated = z.discriminatedUnion("apiProv
330335
fireworksSchema.merge(z.object({ apiProvider: z.literal("fireworks") })),
331336
ioIntelligenceSchema.merge(z.object({ apiProvider: z.literal("io-intelligence") })),
332337
rooSchema.merge(z.object({ apiProvider: z.literal("roo") })),
338+
featherlessSchema.merge(z.object({ apiProvider: z.literal("featherless") })),
333339
defaultSchema,
334340
])
335341

@@ -367,6 +373,7 @@ export const providerSettingsSchema = z.object({
367373
...fireworksSchema.shape,
368374
...ioIntelligenceSchema.shape,
369375
...rooSchema.shape,
376+
...featherlessSchema.shape,
370377
...codebaseIndexProviderSchema.shape,
371378
})
372379

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import type { ModelInfo } from "../model.js"
2+
3+
// Featherless AI models - https://api.featherless.ai/v1/models
4+
export type FeatherlessModelId = keyof typeof featherlessModels
5+
6+
export const featherlessDefaultModelId: FeatherlessModelId = "meta-llama/Meta-Llama-3.1-8B-Instruct"
7+
8+
export const featherlessModels = {
9+
"meta-llama/Meta-Llama-3.1-8B-Instruct": {
10+
maxTokens: 8192,
11+
contextWindow: 131072,
12+
supportsImages: false,
13+
supportsPromptCache: false,
14+
inputPrice: 0.1,
15+
outputPrice: 0.1,
16+
description: "Meta's Llama 3.1 8B Instruct model with 128K context window",
17+
},
18+
"meta-llama/Meta-Llama-3.1-70B-Instruct": {
19+
maxTokens: 8192,
20+
contextWindow: 131072,
21+
supportsImages: false,
22+
supportsPromptCache: false,
23+
inputPrice: 0.4,
24+
outputPrice: 0.4,
25+
description: "Meta's Llama 3.1 70B Instruct model with 128K context window",
26+
},
27+
"meta-llama/Meta-Llama-3.1-405B-Instruct": {
28+
maxTokens: 8192,
29+
contextWindow: 131072,
30+
supportsImages: false,
31+
supportsPromptCache: false,
32+
inputPrice: 2.0,
33+
outputPrice: 2.0,
34+
description: "Meta's largest Llama 3.1 405B Instruct model with 128K context window",
35+
},
36+
"Qwen/Qwen2.5-72B-Instruct": {
37+
maxTokens: 8192,
38+
contextWindow: 131072,
39+
supportsImages: false,
40+
supportsPromptCache: false,
41+
inputPrice: 0.4,
42+
outputPrice: 0.4,
43+
description: "Alibaba's Qwen 2.5 72B Instruct model with 128K context window",
44+
},
45+
"mistralai/Mistral-7B-Instruct-v0.3": {
46+
maxTokens: 8192,
47+
contextWindow: 32768,
48+
supportsImages: false,
49+
supportsPromptCache: false,
50+
inputPrice: 0.1,
51+
outputPrice: 0.1,
52+
description: "Mistral's 7B Instruct v0.3 model with 32K context window",
53+
},
54+
"mistralai/Mixtral-8x7B-Instruct-v0.1": {
55+
maxTokens: 8192,
56+
contextWindow: 32768,
57+
supportsImages: false,
58+
supportsPromptCache: false,
59+
inputPrice: 0.3,
60+
outputPrice: 0.3,
61+
description: "Mistral's Mixtral 8x7B MoE Instruct model with 32K context window",
62+
},
63+
"deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B": {
64+
maxTokens: 4096,
65+
contextWindow: 131072,
66+
supportsImages: false,
67+
supportsPromptCache: false,
68+
inputPrice: 0.05,
69+
outputPrice: 0.05,
70+
description: "DeepSeek R1 Distill Qwen 1.5B model with 128K context window",
71+
},
72+
"moonshotai/Kimi-K2-Instruct": {
73+
maxTokens: 16384,
74+
contextWindow: 16384,
75+
supportsImages: false,
76+
supportsPromptCache: false,
77+
inputPrice: 0.3,
78+
outputPrice: 0.3,
79+
description: "Moonshot AI's Kimi K2 Instruct model with tool use support",
80+
},
81+
} 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
@@ -4,6 +4,7 @@ export * from "./cerebras.js"
44
export * from "./chutes.js"
55
export * from "./claude-code.js"
66
export * from "./deepseek.js"
7+
export * from "./featherless.js"
78
export * from "./gemini.js"
89
export * from "./glama.js"
910
export * from "./groq.js"

src/api/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
RequestyHandler,
2525
HumanRelayHandler,
2626
FakeAIHandler,
27+
FeatherlessHandler,
2728
XAIHandler,
2829
GroqHandler,
2930
HuggingFaceHandler,
@@ -143,6 +144,8 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
143144
return new IOIntelligenceHandler(options)
144145
case "roo":
145146
return new RooHandler(options)
147+
case "featherless":
148+
return new FeatherlessHandler(options)
146149
default:
147150
apiProvider satisfies "gemini-cli" | undefined
148151
return new AnthropicHandler(options)

src/api/providers/featherless.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { type FeatherlessModelId, featherlessDefaultModelId, featherlessModels } from "@roo-code/types"
2+
3+
import type { ApiHandlerOptions } from "../../shared/api"
4+
5+
import { BaseOpenAiCompatibleProvider } from "./base-openai-compatible-provider"
6+
7+
export class FeatherlessHandler extends BaseOpenAiCompatibleProvider<FeatherlessModelId> {
8+
constructor(options: ApiHandlerOptions) {
9+
super({
10+
...options,
11+
providerName: "Featherless",
12+
baseURL: "https://api.featherless.ai/v1",
13+
apiKey: options.featherlessApiKey,
14+
defaultProviderModelId: featherlessDefaultModelId,
15+
providerModels: featherlessModels,
16+
defaultTemperature: 0.7,
17+
})
18+
}
19+
}

src/api/providers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export { DeepSeekHandler } from "./deepseek"
88
export { DoubaoHandler } from "./doubao"
99
export { MoonshotHandler } from "./moonshot"
1010
export { FakeAIHandler } from "./fake-ai"
11+
export { FeatherlessHandler } from "./featherless"
1112
export { GeminiHandler } from "./gemini"
1213
export { GlamaHandler } from "./glama"
1314
export { GroqHandler } from "./groq"

0 commit comments

Comments
 (0)