Skip to content

Commit

Permalink
💄 style: Add new model provider Novita AI (lobehub#3177)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonhp authored and ipoly committed Jul 29, 2024
1 parent bfb2026 commit 839aedb
Show file tree
Hide file tree
Showing 19 changed files with 579 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ We have implemented support for the following model service providers:
- **Minimax**: Integrated the Minimax models, including the MoE model **abab6**, offers a broader range of choices. [Learn more](https://www.minimaxi.com/)
- **DeepSeek**: Integrated with the DeepSeek series models, an innovative AI startup from China, The product has been designed to provide a model that balances performance with price. [Learn more](https://www.deepseek.com/)
- **Qwen**: Integrated the Qwen series models, including the latest **qwen-turbo**, **qwen-plus** and **qwen-max**. [Lean more](https://help.aliyun.com/zh/dashscope/developer-reference/model-introduction)
- **Novita AI**: Access **Llama**, **Mistral**, and other leading open-source models at cheapest prices. Engage in uncensored role-play, spark creative discussions, and foster unrestricted innovation. **Pay For What You Use.** [Learn more](https://novita.ai/llm-api?utm_source=lobechat&utm_medium=ch&utm_campaign=api)

At the same time, we are also planning to support more model service providers, such as Replicate and Perplexity, to further enrich our service provider library. If you would like LobeChat to support your favorite service provider, feel free to join our [community discussion](https://github.com/lobehub/lobe-chat/discussions/1284).

Expand Down
80 changes: 80 additions & 0 deletions docs/usage/providers/novita.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
title: Using Novita AI API Key in LobeChat
description: >-
Learn how to integrate Novita AI's language model APIs into LobeChat. Follow the steps to register, create an Novita AI API key,
configure settings, and chat with our various AI models.
tags:
- Novita AI
- Llama3
- Mistral
- uncensored
- API key
- Web UI
---

# Using Novita AI in LobeChat

<Image
alt={'Using Novita AI in LobeChat'}
cover
src={'https://github.com/user-attachments/assets/b2b36128-6a43-4a1f-9c08-99fe73fb565f'}
/>

[Novita AI](https://novita.ai/) is an AI API platform that provides a variety of LLM and image generation APIs, supporting Llama3 (8B, 70B), Mistral, and many other cutting-edge models. We offer a variety of censored and uncensored models to meet your different needs.

This document will guide you on how to integrate Novita AI in LobeChat:

<Steps>

### Step 1: Register and Log in to Novita AI

- Visit [Novita.ai](https://novita.ai/) and create an account
- You can log in with your Google or Github account
- Upon registration, Novita AI will provide a $0.5 credit.

<Image
alt={'Register OpenRouter'}
height={457}
inStep
src={'https://github.com/user-attachments/assets/f3177ce2-281c-4ed4-a061-239547b466c6'}
/>

### Step 2: Obtain the API Key

- Visit Novita AI's [key management page](https://novita.ai/dashboard/key), create and copy an API Key.

<Image
alt={'Obtain Novita AI API key'}
inStep
src={'https://github.com/user-attachments/assets/1e33aff2-6186-4e1f-80a8-4a2c855d8cc1'}
/>

### Step 3: Configure Novita AI in LobeChat

- Visit the `Settings` interface in LobeChat
- Find the setting for `novita.ai` under `Language Model`

<Image
alt={'Enter Novita AI API key in LobeChat'}
inStep
src={'https://github.com/user-attachments/assets/00c02637-873e-4e7e-9dc3-a95085b16dd7'}
/>

- Open novita.ai and enter the obtained API key
- Choose a Novita AI model for your assistant to start the conversation

<Image
alt={'Select and use Novita AI model'}
inStep
src={'https://github.com/user-attachments/assets/6f9f400a-72e0-49de-94cb-5069fddf1163'}
/>

<Callout type={'warning'}>
During usage, you may need to pay the API service provider, please refer to Novita AI's pricing
policy.
</Callout>

</Steps>

You can now engage in conversations using the models provided by Novita AI in LobeChat.
76 changes: 76 additions & 0 deletions docs/usage/providers/novita.zh-CN.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: 在 LobeChat 中使用 Novita AI API Key
description: 学习如何将 Novita AI 的大语言模型 API 集成到 LobeChat 中。跟随以下步骤注册 Novita AI 账号、创建 API Key、充值信用额度并在 LobeChat 中进行设置。并与我们的多种 AI 模型交谈。
tags:
- Novita AI
- Llama3
- Mistral
- uncensored
- API key
- Web UI
---

# 在 LobeChat 中使用 Novita AI

<Image
alt={'在 LobeChat 中使用 Novita AI'}
cover
src={'https://github.com/user-attachments/assets/b2b36128-6a43-4a1f-9c08-99fe73fb565f'}
/>

[Novita AI](https://novita.ai/) 是一个 AI API 平台,它提供多种大语言模型与 AI 图像生成的 API 服务。支持 Llama3 (8B, 70B),Mistral 和其他最新的模型。

本文档将指导你如何在 LobeChat 中使用 Novita AI:

<Steps>

### 步骤一:注册 Novita AI 账号并登录

- 访问 [Novita.ai](https://novita.ai/) 并创建账号
- 你可以使用 Google 或者 Github 账号登录
- 注册后,Novita AI 会赠送 0.5 美元的使用额度

<Image
alt={'注册 Novita AI'}
height={457}
inStep
src={'https://github.com/user-attachments/assets/f3177ce2-281c-4ed4-a061-239547b466c6'}
/>

### 步骤二:创建 API 密钥

- 访问 Novita AI 的 [密钥管理页面](https://novita.ai/dashboard/key) ,创建并且复制一个 API 密钥.

<Image
alt={'创建 Novita AI API 密钥'}
inStep
src={'https://github.com/user-attachments/assets/1e33aff2-6186-4e1f-80a8-4a2c855d8cc1'}
/>

### 步骤三:在 LobeChat 中配置 Novita AI

- 访问 LobeChat 的 `设置` 界面
-`语言模型` 下找到 `novita.ai` 的设置项
- 打开 novita.ai 并填入获得的 API 密钥

<Image
alt={'在 LobeChat 中输入 Novita AI API 密钥'}
inStep
src={'https://github.com/user-attachments/assets/00c02637-873e-4e7e-9dc3-a95085b16dd7'}
/>

- 为你的助手选择一个 Novita AI 模型即可开始对话

<Image
alt={'Select and use Novita AI model'}
inStep
src={'https://github.com/user-attachments/assets/6f9f400a-72e0-49de-94cb-5069fddf1163'}
/>

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

</Steps>

至此你已经可以在 LobeChat 中使用 Novita AI 提供的模型进行对话了。
11 changes: 9 additions & 2 deletions src/app/(main)/settings/llm/ProviderList/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Minimax,
Mistral,
Moonshot,
Novita,
OpenRouter,
Perplexity,
Stepfun,
Expand All @@ -35,6 +36,7 @@ import {
MinimaxProviderCard,
MistralProviderCard,
MoonshotProviderCard,
NovitaProviderCard,
OpenRouterProviderCard,
PerplexityProviderCard,
QwenProviderCard,
Expand Down Expand Up @@ -126,6 +128,11 @@ export const useProviderList = (): ProviderItem[] => {
docUrl: urlJoin(BASE_DOC_URL, 'openrouter'),
title: <OpenRouter.Combine iconProps={{ color: OpenRouter.colorPrimary }} size={20} />,
},
{
...NovitaProviderCard,
docUrl: urlJoin(BASE_DOC_URL, 'novita'),
title: <Novita.Combine size={20} type={'color'} />,
},
{
...TogetherAIProviderCard,
docUrl: urlJoin(BASE_DOC_URL, 'togetherai'),
Expand Down Expand Up @@ -179,12 +186,12 @@ export const useProviderList = (): ProviderItem[] => {
{
...BaichuanProviderCard,
docUrl: urlJoin(BASE_DOC_URL, 'baichuan'),
title: <Baichuan.Combine size={ 20 } type={ 'color' } />,
title: <Baichuan.Combine size={20} type={'color'} />,
},
{
...TaichuProviderCard,
docUrl: urlJoin(BASE_DOC_URL, 'taichu'),
title: <AiMass.Combine size={ 28 } type={ 'color' } />,
title: <AiMass.Combine size={28} type={'color'} />,
},
{
...Ai360ProviderCard,
Expand Down
7 changes: 7 additions & 0 deletions src/app/api/chat/agentRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ const getLlmOptionsFromPayload = (provider: string, payload: JWTPayload) => {

return { apiKey };
}
case ModelProvider.Novita: {
const { NOVITA_API_KEY } = getLLMConfig();

const apiKey = apiKeyManager.pick(payload?.apiKey || NOVITA_API_KEY);

return { apiKey };
}
case ModelProvider.Baichuan: {
const { BAICHUAN_API_KEY } = getLLMConfig();

Expand Down
5 changes: 5 additions & 0 deletions src/components/ModelProviderIcon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
Minimax,
Mistral,
Moonshot,
Novita,
Ollama,
OpenAI,
OpenRouter,
Expand Down Expand Up @@ -117,6 +118,10 @@ const ModelProviderIcon = memo<ModelProviderIconProps>(({ provider }) => {
return <Stepfun size={20} />;
}

case ModelProvider.Novita: {
return <Novita size={20} />;
}

case ModelProvider.Baichuan: {
return <Baichuan size={20} />;
}
Expand Down
6 changes: 6 additions & 0 deletions src/config/llm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ export const getLLMConfig = () => {
ENABLED_STEPFUN: z.boolean(),
STEPFUN_API_KEY: z.string().optional(),

ENABLED_NOVITA: z.boolean(),
NOVITA_API_KEY: z.string().optional(),

ENABLED_BAICHUAN: z.boolean(),
BAICHUAN_API_KEY: z.string().optional(),

Expand Down Expand Up @@ -157,6 +160,9 @@ export const getLLMConfig = () => {
ENABLED_STEPFUN: !!process.env.STEPFUN_API_KEY,
STEPFUN_API_KEY: process.env.STEPFUN_API_KEY,

ENABLED_NOVITA: !!process.env.NOVITA_API_KEY,
NOVITA_API_KEY: process.env.NOVITA_API_KEY,

ENABLED_BAICHUAN: !!process.env.BAICHUAN_API_KEY,
BAICHUAN_API_KEY: process.env.BAICHUAN_API_KEY,

Expand Down
4 changes: 4 additions & 0 deletions src/config/modelProviders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import GroqProvider from './groq';
import MinimaxProvider from './minimax';
import MistralProvider from './mistral';
import MoonshotProvider from './moonshot';
import NovitaProvider from './novita';
import OllamaProvider from './ollama';
import OpenAIProvider from './openai';
import OpenRouterProvider from './openrouter';
Expand Down Expand Up @@ -40,6 +41,7 @@ export const LOBE_DEFAULT_MODEL_LIST: ChatModelCard[] = [
AnthropicProvider.chatModels,
ZeroOneProvider.chatModels,
StepfunProvider.chatModels,
NovitaProvider.chatModels,
BaichuanProvider.chatModels,
TaichuProvider.chatModels,
Ai360Provider.chatModels,
Expand All @@ -64,6 +66,7 @@ export const DEFAULT_MODEL_PROVIDER_LIST = [
ZeroOneProvider,
ZhiPuProvider,
StepfunProvider,
NovitaProvider,
BaichuanProvider,
TaichuProvider,
Ai360Provider,
Expand All @@ -89,6 +92,7 @@ export { default as GroqProviderCard } from './groq';
export { default as MinimaxProviderCard } from './minimax';
export { default as MistralProviderCard } from './mistral';
export { default as MoonshotProviderCard } from './moonshot';
export { default as NovitaProviderCard } from './novita';
export { default as OllamaProviderCard } from './ollama';
export { default as OpenAIProviderCard } from './openai';
export { default as OpenRouterProviderCard } from './openrouter';
Expand Down
91 changes: 91 additions & 0 deletions src/config/modelProviders/novita.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { ModelProviderCard } from '@/types/llm';

const Novita: ModelProviderCard = {
chatModels: [
{
displayName: 'Llama3 8B Instruct',
enabled: true,
id: 'meta-llama/llama-3-8b-instruct',
tokens: 8192,
},
{
displayName: 'Llama3 70B Instruct',
enabled: true,
id: 'meta-llama/llama-3-70b-instruct',
tokens: 8192,
},
{
displayName: 'Nous Hermes 2 Pro - Llama3 8B',
enabled: true,
id: 'nousresearch/hermes-2-pro-llama-3-8b',
tokens: 8192,
},
{
displayName: 'Nous Hermes - Llama2 8B',
enabled: true,
id: 'nousresearch/nous-hermes-llama2-13b',
tokens: 4096,
},
{
displayName: 'Mistral 7B Instruct',
enabled: true,
id: 'mistralai/mistral-7b-instruct',
tokens: 32_768,
},
{
displayName: 'Dolphin Mixtral 8x22B',
enabled: true,
id: 'cognitivecomputations/dolphin-mixtral-8x22b',
tokens: 16_000,
},
{
displayName: 'L3-70b-Euryale-v2.1',
enabled: true,
id: 'sao10k/l3-70b-euryale-v2.1',
tokens: 16_000,
},
{
displayName: 'Midnight Rose 70B',
enabled: true,
id: 'sophosympatheia/midnight-rose-70b',
tokens: 4096,
},
{
displayName: 'Mythomax L2 13b',
enabled: true,
id: 'gryphe/mythomax-l2-13b',
tokens: 4096,
},
{
displayName: 'Nous Hermes 2 - Mixtral 8x7B-DPO',
enabled: true,
id: 'Nous-Hermes-2-Mixtral-8x7B-DPO',
tokens: 32_768,
},
{
displayName: 'Lzlv 70b',
enabled: true,
id: 'lzlv_70b',
tokens: 4096,
},
{
displayName: 'Open Hermes 2.5 Mistral 7B',
enabled: true,
id: 'teknium/openhermes-2.5-mistral-7b',
tokens: 4096,
},
{
displayName: 'Wizardlm2 8x22B',
enabled: true,
id: 'microsoft/wizardlm-2-8x22b',
tokens: 65_535,
},
],
checkModel: 'meta-llama/llama-3-70b-instruct',
disableBrowserRequest: true,
id: 'novita',
modelList: { showModelFetcher: true },
name: 'Novita',
};

export default Novita;
Loading

0 comments on commit 839aedb

Please sign in to comment.