Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ ENV \
COHERE_API_KEY="" COHERE_MODEL_LIST="" COHERE_PROXY_URL="" \
# DeepSeek
DEEPSEEK_API_KEY="" DEEPSEEK_MODEL_LIST="" \
# Featherless AI
FEATHERLESSAI_API_KEY="" FEATHERLESSAI_MODEL_LIST="" \
# Fireworks AI
FIREWORKSAI_API_KEY="" FIREWORKSAI_MODEL_LIST="" \
# Gitee AI
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile.database
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ ENV \
COHERE_API_KEY="" COHERE_MODEL_LIST="" COHERE_PROXY_URL="" \
# DeepSeek
DEEPSEEK_API_KEY="" DEEPSEEK_MODEL_LIST="" \
# Featherless AI
FEATHERLESSAI_API_KEY="" FEATHERLESSAI_MODEL_LIST="" \
# Fireworks AI
FIREWORKSAI_API_KEY="" FIREWORKSAI_MODEL_LIST="" \
# Gitee AI
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile.pglite
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ ENV \
COHERE_API_KEY="" COHERE_MODEL_LIST="" COHERE_PROXY_URL="" \
# DeepSeek
DEEPSEEK_API_KEY="" DEEPSEEK_MODEL_LIST="" \
# Featherless AI
FEATHERLESSAI_API_KEY="" FEATHERLESSAI_MODEL_LIST="" \
# Fireworks AI
FIREWORKSAI_API_KEY="" FIREWORKSAI_MODEL_LIST="" \
# Gitee AI
Expand Down
51 changes: 51 additions & 0 deletions docs/usage/providers/featherlessai.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: Using Featherless AI API Key in LobeChat
description: Learn how to configure and use Featherless AI models in LobeChat, obtain an API key, and start a conversation.
tags:
- LobeChat
- Featherless AI
- API Key
- Web UI
---

# Using Featherless AI in LobeChat

<Image alt={'Using Featherless AI in LobeChat'} cover src={'https://github.com/user-attachments/assets/1028aa1a-6c19-4191-b28a-2020e5637155'} />

[Featherless](https://featherless.ai/) is a serverless AI inference platform. Our goal is to make all AI models available for serverless inference and we’ve started with large language models (e.g. Qwen, Llama, Mistral, DeepSeek, RWKV). We provide inference via API to a continually expanding library of open-weight models, including the most popular models for role-playing, creative writing, coding assistance, and more.

This document will guide you on how to use Featherless AI in LobeChat:

<Steps>
### Step 1: Obtain a Featherless AI API Key

- First, you need to register and log in to [Featherless AI Cloud](https://featherless.ai/)
- Create an API key in your dashboard

<Image alt={'Obtain a Featherless AI API Key'} inStep src={'https://github.com/user-attachments/assets/ed6965c8-6884-4adf-a457-573a96755f55'} />

- Copy the obtained API key and save it securely

<Callout type={'warning'}>
Please save the generated API Key securely, as it will only appear once. If you accidentally lose
it, you will need to create a new API key.
</Callout>

### Step 2: Configure Featherless AI in LobeChat

- Access the `Application Settings` interface of LobeChat
- Find the `Featherless AI` setting item under `Language Model`

<Image alt={'Fill in the Featherless AI API Key'} inStep src={'https://github.com/user-attachments/assets/328e9755-8da9-4849-8569-e099924822fe'} />

- Turn on Featherless AI and fill in the obtained API key
- Select a Featherless AI model for your assistant to start the conversation

<Image alt={'Select a Featherless AI Model'} inStep src={'https://github.com/user-attachments/assets/6dbf4560-3f62-4b33-9f41-96e12b5087b1'} />

<Callout type={'warning'}>
You may need to pay the API service provider during use, please refer to Featherless AI's related fee policies.
</Callout>
</Steps>

Now you can use the models provided by Featherless AI in LobeChat to conduct conversations.
50 changes: 50 additions & 0 deletions docs/usage/providers/featherlessai.zh-CN.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: 在 LobeChat 中使用 Featherless AI API 密钥
description: 学习如何在 LobeChat 中配置和使用 Featherless AI 模型,获取 API 密钥并开始对话。
tags:
- LobeChat
- Featherless AI
- API 密钥
- Web UI
---

# 在 LobeChat 中使用 Featherless AI

<Image alt={'在 LobeChat 中使用 Featherless AI'} cover src={'https://github.com/user-attachments/assets/1028aa1a-6c19-4191-b28a-2020e5637155'} />

[Featherless](https://featherless.ai/) 是一个无服务器 AI 推理平台。我们的目标是让所有 AI 模型都可以进行无服务器推理,我们已经从大型语言模型开始(例如 Qwen、Llama、Mistral、DeepSeek、RWKV)。我们通过 API 为持续扩展的开源权重模型库提供推理服务,包括用于角色扮演、创意写作、编程辅助等最受欢迎的模型。

本文档将指导您如何在 LobeChat 中使用 Featherless AI:

<Steps>
### 步骤 1:获取 Featherless AI API 密钥

- 首先,您需要注册并登录到 [Featherless AI Cloud](https://featherless.ai/)
- 在您的仪表板中创建一个 API 密钥

<Image alt={'获取 Featherless AI API 密钥'} inStep src={'https://github.com/user-attachments/assets/ed6965c8-6884-4adf-a457-573a96755f55'} />

- 复制获得的 API 密钥并安全保存

<Callout type={'warning'}>
请安全保存生成的 API 密钥,因为它只会出现一次。如果您意外丢失了它,您需要创建一个新的 API 密钥。
</Callout>

### 步骤 2:在 LobeChat 中配置 Featherless AI

- 访问 LobeChat 的 `应用设置` 界面
- 在 `语言模型` 下找到 `Featherless AI` 设置项

<Image alt={'填入 Featherless AI API 密钥'} inStep src={'https://github.com/user-attachments/assets/328e9755-8da9-4849-8569-e099924822fe'} />

- 开启 Featherless AI 并填入获得的 API 密钥
- 为您的助手选择一个 Featherless AI 模型以开始对话

<Image alt={'选择 Featherless AI 模型'} inStep src={'https://github.com/user-attachments/assets/6dbf4560-3f62-4b33-9f41-96e12b5087b1'} />

<Callout type={'warning'}>
在使用过程中您可能需要向 API 服务提供商付费,请参考 Featherless AI 的相关费用政策。
</Callout>
</Steps>

现在您可以在 LobeChat 中使用 Featherless AI 提供的模型进行对话了。
16 changes: 16 additions & 0 deletions packages/model-runtime/src/featherlessai/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// @vitest-environment node
import { ModelProvider } from '@/libs/model-runtime';
import { testProvider } from '@/libs/model-runtime/providerTestUtils';

import { LobeFeatherlessAI } from './index';

const provider = ModelProvider.FeatherlessAI;
const defaultBaseURL = 'https://api.featherless.ai/v1';

testProvider({
Runtime: LobeFeatherlessAI,
provider,
defaultBaseURL,
chatDebugEnv: 'DEBUG_FEATHERLESSAI_CHAT_COMPLETION',
chatModel: 'deepseek-r1',
});
48 changes: 48 additions & 0 deletions packages/model-runtime/src/featherlessai/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import type { ChatModelCard } from '@/types/llm';

import { ModelProvider } from '../types';
import { createOpenAICompatibleRuntime } from '../utils/openaiCompatibleFactory';

export interface FeatherlessAIModelCard {
context_length: number;
id: string;
supports_image_input: boolean;
supports_tools: boolean;
}

export const LobeFeatherlessAI = createOpenAICompatibleRuntime({
baseURL: 'https://api.featherless.ai/v1',
debug: {
chatCompletion: () => process.env.DEBUG_FEATHERLESSAI_CHAT_COMPLETION === '1',
},
models: async ({ client }) => {
const { LOBE_DEFAULT_MODEL_LIST } = await import('@/config/aiModels');

const reasoningKeywords = ['deepseek-r1', 'qwq'];

const modelsPage = (await client.models.list()) as any;
const modelList: FeatherlessAIModelCard[] = modelsPage.data;

return modelList
.map((model) => {
const knownModel = LOBE_DEFAULT_MODEL_LIST.find(
(m) => model.id.toLowerCase() === m.id.toLowerCase(),
);

return {
contextWindowTokens: model.context_length,
displayName: knownModel?.displayName ?? undefined,
enabled: knownModel?.enabled || false,
functionCall: model.supports_tools || model.id.toLowerCase().includes('function'),
id: model.id,
reasoning:
reasoningKeywords.some((keyword) => model.id.toLowerCase().includes(keyword)) ||
knownModel?.abilities?.reasoning ||
false,
vision: model.supports_image_input,
};
})
.filter(Boolean) as ChatModelCard[];
},
provider: ModelProvider.FeatherlessAI,
});
1 change: 1 addition & 0 deletions packages/model-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export * from './BaseAI';
export { LobeBedrockAI } from './bedrock';
export { LobeBflAI } from './bfl';
export { LobeDeepSeekAI } from './deepseek';
export { LobeFeatherlessAI } from './featherlessai';
export * from './error';
export { LobeGoogleAI } from './google';
export { LobeGroq } from './groq';
Expand Down
2 changes: 2 additions & 0 deletions packages/model-runtime/src/runtimeMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { LobeCloudflareAI } from './cloudflare';
import { LobeCohereAI } from './cohere';
import { LobeDeepSeekAI } from './deepseek';
import { LobeFalAI } from './fal';
import { LobeFeatherlessAI } from './featherlessai/index';
import { LobeFireworksAI } from './fireworksai';
import { LobeGiteeAI } from './giteeai';
import { LobeGithubAI } from './github';
Expand Down Expand Up @@ -71,6 +72,7 @@ export const providerRuntimeMap = {
cohere: LobeCohereAI,
deepseek: LobeDeepSeekAI,
fal: LobeFalAI,
featherlessai: LobeFeatherlessAI,
fireworksai: LobeFireworksAI,
giteeai: LobeGiteeAI,
github: LobeGithubAI,
Expand Down
1 change: 1 addition & 0 deletions packages/model-runtime/src/types/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export enum ModelProvider {
Cohere = 'cohere',
DeepSeek = 'deepseek',
Fal = 'fal',
FeatherlessAI = 'featherlessai',
FireworksAI = 'fireworksai',
GiteeAI = 'giteeai',
Github = 'github',
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/user/settings/keyVaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export interface UserKeyVaults extends SearchEngineKeyVaults {
cohere?: OpenAICompatibleKeyVault;
deepseek?: OpenAICompatibleKeyVault;
fal?: FalKeyVault;
featherlessai?: OpenAICompatibleKeyVault;
fireworksai?: OpenAICompatibleKeyVault;
giteeai?: OpenAICompatibleKeyVault;
github?: OpenAICompatibleKeyVault;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
BaichuanProviderCard,
CohereProviderCard,
DeepSeekProviderCard,
FeatherlessAIProviderCard,
FireworksAIProviderCard,
GiteeAIProviderCard,
GoogleProviderCard,
Expand Down Expand Up @@ -80,6 +81,7 @@ export const useProviderList = (): ProviderItem[] => {
GithubProvider,
NovitaProviderCard,
TogetherAIProviderCard,
FeatherlessAIProviderCard,
FireworksAIProviderCard,
GroqProviderCard,
NvidiaProviderCard,
Expand Down
Loading
Loading