-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: add Featherless AI as a provider #7238
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import type { ModelInfo } from "../model.js" | ||
|
|
||
| // Featherless AI models - https://api.featherless.ai/v1/models | ||
| export type FeatherlessModelId = keyof typeof featherlessModels | ||
|
|
||
| export const featherlessDefaultModelId: FeatherlessModelId = "meta-llama/Meta-Llama-3.1-8B-Instruct" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have we confirmed that all these model IDs are actually available through Featherless AI's API? It would be good to verify these against their API documentation or model list endpoint at https://api.featherless.ai/v1/models |
||
|
|
||
| export const featherlessModels = { | ||
| "meta-llama/Meta-Llama-3.1-8B-Instruct": { | ||
| maxTokens: 8192, | ||
| contextWindow: 131072, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.1, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The pricing values here (0.1, 0.4, 2.0, etc.) appear to be placeholder values. Could we verify the actual pricing from Featherless AI's documentation? These rounded values might not reflect the actual per-token costs. |
||
| outputPrice: 0.1, | ||
| description: "Meta's Llama 3.1 8B Instruct model with 128K context window", | ||
| }, | ||
| "meta-llama/Meta-Llama-3.1-70B-Instruct": { | ||
| maxTokens: 8192, | ||
| contextWindow: 131072, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.4, | ||
| outputPrice: 0.4, | ||
| description: "Meta's Llama 3.1 70B Instruct model with 128K context window", | ||
| }, | ||
| "meta-llama/Meta-Llama-3.1-405B-Instruct": { | ||
| maxTokens: 8192, | ||
| contextWindow: 131072, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 2.0, | ||
| outputPrice: 2.0, | ||
| description: "Meta's largest Llama 3.1 405B Instruct model with 128K context window", | ||
| }, | ||
| "Qwen/Qwen2.5-72B-Instruct": { | ||
| maxTokens: 8192, | ||
| contextWindow: 131072, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.4, | ||
| outputPrice: 0.4, | ||
| description: "Alibaba's Qwen 2.5 72B Instruct model with 128K context window", | ||
| }, | ||
| "mistralai/Mistral-7B-Instruct-v0.3": { | ||
| maxTokens: 8192, | ||
| contextWindow: 32768, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.1, | ||
| outputPrice: 0.1, | ||
| description: "Mistral's 7B Instruct v0.3 model with 32K context window", | ||
| }, | ||
| "mistralai/Mixtral-8x7B-Instruct-v0.1": { | ||
| maxTokens: 8192, | ||
| contextWindow: 32768, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.3, | ||
| outputPrice: 0.3, | ||
| description: "Mistral's Mixtral 8x7B MoE Instruct model with 32K context window", | ||
| }, | ||
| "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B": { | ||
| maxTokens: 4096, | ||
| contextWindow: 131072, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.05, | ||
| outputPrice: 0.05, | ||
| description: "DeepSeek R1 Distill Qwen 1.5B model with 128K context window", | ||
| }, | ||
| "moonshotai/Kimi-K2-Instruct": { | ||
| maxTokens: 16384, | ||
| contextWindow: 16384, | ||
| supportsImages: false, | ||
| supportsPromptCache: false, | ||
| inputPrice: 0.3, | ||
| outputPrice: 0.3, | ||
| description: "Moonshot AI's Kimi K2 Instruct model with tool use support", | ||
| }, | ||
| } as const satisfies Record<string, ModelInfo> | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,19 @@ | ||||||||||||||||||||||||||||||
| import { type FeatherlessModelId, featherlessDefaultModelId, featherlessModels } from "@roo-code/types" | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| import type { ApiHandlerOptions } from "../../shared/api" | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| import { BaseOpenAiCompatibleProvider } from "./base-openai-compatible-provider" | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| export class FeatherlessHandler extends BaseOpenAiCompatibleProvider<FeatherlessModelId> { | ||||||||||||||||||||||||||||||
| constructor(options: ApiHandlerOptions) { | ||||||||||||||||||||||||||||||
| super({ | ||||||||||||||||||||||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While the base class checks for apiKey, could we add a more specific error message for missing Featherless API key? Something like:
Suggested change
|
||||||||||||||||||||||||||||||
| ...options, | ||||||||||||||||||||||||||||||
| providerName: "Featherless", | ||||||||||||||||||||||||||||||
| baseURL: "https://api.featherless.ai/v1", | ||||||||||||||||||||||||||||||
| apiKey: options.featherlessApiKey, | ||||||||||||||||||||||||||||||
| defaultProviderModelId: featherlessDefaultModelId, | ||||||||||||||||||||||||||||||
| providerModels: featherlessModels, | ||||||||||||||||||||||||||||||
| defaultTemperature: 0.7, | ||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
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.
Consider adding the actual API documentation URL here for reference, not just the models endpoint. This would help future maintainers understand the API structure.