Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🥧 feat: APIpie support (#2524)
Fuegovicca9a0fe62948
diff --git a/.env.example b/.env.exampleindex c8a1dc408d..7b46e29b20 100644--- a/.env.example+++ b/.env.example@@ -64,13 +64,14 @@ PROXY=#===================================## https://docs.librechat.ai/install/configuration/ai_endpoints.html-# GROQ_API_KEY=-# SHUTTLEAI_KEY=-# OPENROUTER_KEY=-# MISTRAL_API_KEY=# ANYSCALE_API_KEY=+# APIPIE_API_KEY=# FIREWORKS_API_KEY=+# GROQ_API_KEY=+# MISTRAL_API_KEY=+# OPENROUTER_KEY=# PERPLEXITY_API_KEY=+# SHUTTLEAI_API_KEY=# TOGETHERAI_API_KEY=#============#diff --git a/client/public/assets/ShuttleAI_Fibonacci.png b/client/public/assets/ShuttleAI_Fibonacci.pngdeleted file mode 100644index eddeb4e362..0000000000Binary files a/client/public/assets/ShuttleAI_Fibonacci.png and /dev/null differdiff --git a/client/public/assets/apipie.png b/client/public/assets/apipie.pngnew file mode 100644index 0000000000..f133c46610Binary files /dev/null and b/client/public/assets/apipie.png differdiff --git a/client/src/components/Chat/Menus/Endpoints/UnknownIcon.tsx b/client/src/components/Chat/Menus/Endpoints/UnknownIcon.tsxindex 0c7662bac5..8999f1e42a 100644--- a/client/src/components/Chat/Menus/Endpoints/UnknownIcon.tsx+++ b/client/src/components/Chat/Menus/Endpoints/UnknownIcon.tsx@@ -3,16 +3,17 @@ import { CustomMinimalIcon } from '~/components/svg';import { IconContext } from '~/common';const knownEndpointAssets = {- [KnownEndpoints.mistral]: '/assets/mistral.png',- [KnownEndpoints.openrouter]: '/assets/openrouter.png',- [KnownEndpoints.groq]: '/assets/groq.png',- [KnownEndpoints.shuttleai]: '/assets/shuttleai.png',[KnownEndpoints.anyscale]: '/assets/anyscale.png',+ [KnownEndpoints.apipie]: '/assets/apipie.png',+ [KnownEndpoints.cohere]: '/assets/cohere.png',[KnownEndpoints.fireworks]: '/assets/fireworks.png',+ [KnownEndpoints.groq]: '/assets/groq.png',+ [KnownEndpoints.mistral]: '/assets/mistral.png',[KnownEndpoints.ollama]: '/assets/ollama.png',+ [KnownEndpoints.openrouter]: '/assets/openrouter.png',[KnownEndpoints.perplexity]: '/assets/perplexity.png',+ [KnownEndpoints.shuttleai]: '/assets/shuttleai.png',[KnownEndpoints['together.ai']]: '/assets/together.png',- [KnownEndpoints.cohere]: '/assets/cohere.png',};const knownEndpointClasses = {diff --git a/docs/install/configuration/ai_endpoints.md b/docs/install/configuration/ai_endpoints.mdindex 6a7f5d6d4c..d0be387d47 100644--- a/docs/install/configuration/ai_endpoints.md+++ b/docs/install/configuration/ai_endpoints.md@@ -14,6 +14,127 @@ In all of the examples, arbitrary environment variable names are defined but youSome of the endpoints are marked as **Known,** which means they might have special handling and/or an icon already provided in the app for you.+## Anyscale+> Anyscale API key: [anyscale.com/credentials](https://app.endpoints.anyscale.com/credentials)++**Notes:**++- **Known:** icon provided, fetching list of models is recommended.++```yaml+ - name: "Anyscale"+ apiKey: "${ANYSCALE_API_KEY}"+ baseURL: "https://api.endpoints.anyscale.com/v1"+ models:+ default: [+ "meta-llama/Llama-2-7b-chat-hf",+ ]+ fetch: true+ titleConvo: true+ titleModel: "meta-llama/Llama-2-7b-chat-hf"+ summarize: false+ summaryModel: "meta-llama/Llama-2-7b-chat-hf"+ forcePrompt: false+ modelDisplayLabel: "Anyscale"+```++++## APIpie++> APIpie API key: [apipie.ai/dashboard/profile/api-keys](https://apipie.ai/dashboard/profile/api-keys)++**Notes:**++- **Known:** icon provided, fetching list of models is recommended as API token rates and pricing used for token credit balances when models are fetched.++- **Known issue:**+ - Fetching list of models is not supported.+ - Your success may vary with conversation titling+ - Stream isn't currently supported (but is planned as of April 24, 2024)+ - Certain models may be strict not allow certain fields in which case, you should use [`dropParams`.](./custom_config.md#dropparams)++??? tip "Fetch models"+ This python script can fetch and order the llm models for you. The output will be saved in models.txt, formated in a way that should make it easier for you to include in the yaml config.++ Replace `<YOUR_API_KEY_HERE>` with your actual APIpie API key++ ```py title="fetch.py"+ import json+ import requests++ def fetch_and_order_models():+ # API endpoint+ url = "https://apipie.ai/models?type=llm"++ # headers as per request example+ headers = {+ 'Accept': 'application/json',+ 'X-API-key': '<YOUR_API_KEY_HERE>'+ }++ # make request+ response = requests.request("GET", url, headers=headers)++ # parse JSON response+ data = json.loads(response.text)++ # extract an ordered list of unique model IDs+ model_ids = sorted(set(model['id'] for model in data))++ # add quotes around model_ids and newlines for each model+ quoted_model_ids = [' "' + str(model_id) + '",\n' for model_id in model_ids]++ # construct the output string+ output_str = 'models:\n default: [\n' + ''.join(quoted_model_ids) + ']\n'++ # remove last comma and newline+ output_str = output_str.rstrip(',\n') + '\n'++ # write result to a text file+ with open('models.txt', 'w') as file:+ file.write(output_str)++ # execute the function+ if __name__ == '__main__':+ fetch_and_order_models()+ ```++```yaml+ # APIpie+ - name: "APIpie"+ apiKey: "${APIPIE_API_KEY}"+ baseURL: "https://apipie.ai/v1/"+ models:+ default: [+ "gpt-4",+ "gpt-4-turbo",+ "gpt-3.5-turbo",+ "claude-3-opus",+ "claude-3-sonnet",+ "claude-3-haiku",+ "llama-3-70b-instruct",+ "llama-3-8b-instruct",+ "gemini-pro-1.5",+ "gemini-pro",+ "mistral-large",+ "mistral-medium",+ "mistral-small",+ "mistral-tiny",+ "mixtral-8x22b",+ ]+ fetch: false+ titleConvo: true+ titleModel: "claude-3-haiku"+ summarize: false+ summaryModel: "claude-3-haiku"+ dropParams: ["stream"]+ modelDisplayLabel: "APIpie"+```++++## Cohere> Cohere API key: [dashboard.cohere.com](https://dashboard.cohere.com/)@@ -47,6 +168,34 @@ Some of the endpoints are marked as **Known,** which means they might have speci+## Fireworks+> Fireworks API key: [fireworks.ai/api-keys](https://fireworks.ai/api-keys)++**Notes:**++- **Known:** icon provided, fetching list of models is recommended.+- - API may be strict for some models, and may not allow fields like `user`, in which case, you should use [`dropParams`.](./custom_config.md#dropparams)++```yaml+ - name: "Fireworks"+ apiKey: "${FIREWORKS_API_KEY}"+ baseURL: "https://api.fireworks.ai/inference/v1"+ models:+ default: [+ "accounts/fireworks/models/mixtral-8x7b-instruct",+ ]+ fetch: true+ titleConvo: true+ titleModel: "accounts/fireworks/models/llama-v2-7b-chat"+ summarize: false+ summaryModel: "accounts/fireworks/models/llama-v2-7b-chat"+ forcePrompt: false+ modelDisplayLabel: "Fireworks"+ dropParams: ["user"]+```+++## Groq> groq API key: [wow.groq.com](https://wow.groq.com/)@@ -79,6 +228,29 @@ Some of the endpoints are marked as **Known,** which means they might have speci+## LiteLLM+> LiteLLM API key: master_key value [LiteLLM](./litellm.md)++**Notes:**++- Reference [LiteLLM](./litellm.md) for configuration.++```yaml+ - name: "LiteLLM"+ apiKey: "sk-from-config-file"+ baseURL: "http://localhost:8000/v1"+ # if using LiteLLM example in docker-compose.override.yml.example, use "http://litellm:8000/v1"+ models:+ default: ["gpt-3.5-turbo"]+ fetch: true+ titleConvo: true+ titleModel: "gpt-3.5-turbo"+ summarize: false+ summaryModel: "gpt-3.5-turbo"+ forcePrompt: false+ modelDisplayLabel: "LiteLLM"+```+## Mistral AI> Mistral API key: [console.mistral.ai](https://console.mistral.ai/)@@ -109,6 +281,65 @@ Some of the endpoints are marked as **Known,** which means they might have speci+## Ollama+> Ollama API key: Required but ignored - [Ollama OpenAI Compatibility](https://github.com/ollama/ollama/blob/main/docs/openai.md)++**Notes:**++- **Known:** icon provided.+- **Known issue:** fetching list of models is not supported. See [Pull Request 2728](https://github.com/ollama/ollama/pull/2728).+- Download models with ollama run command. See [Ollama Library](https://ollama.com/library)+- The example includes a top 5 popular model list from the Ollama Library, which was last updated on March 1, 2024, for your convenience.++```yaml+ - name: "Ollama"+ apiKey: "ollama"+ # use 'host.docker.internal' instead of localhost if running LibreChat in a docker container+ baseURL: "http://localhost:11434/v1/chat/completions"+ models:+ default: [+ "llama2",+ "mistral",+ "codellama",+ "dolphin-mixtral",+ "mistral-openorca"+ ]+ fetch: false # fetching list of models is not supported+ titleConvo: true+ titleModel: "llama2"+ summarize: false+ summaryModel: "llama2"+ forcePrompt: false+ modelDisplayLabel: "Ollama"+```++!!! tip "Ollama -> llama3"++ To prevent the behavior where llama3 does not stop generating, add this `addParams` block to the config:++ ```yaml+ - name: "Ollama"+ apiKey: "ollama"+ baseURL: "http://host.docker.internal:11434/v1/"+ models:+ default: [+ "llama3"+ ]+ fetch: false # fetching list of models is not supported+ titleConvo: true+ titleModel: "llama3"+ summarize: false+ summaryModel: "llama3"+ forcePrompt: false+ modelDisplayLabel: "Ollama"+ addParams:+ "stop": [+ "<|start_header_id|>",+ "<|end_header_id|>",+ "<|eot_id|>",+ "<|reserved_special_token"+ ]+ ```## Openrouter> OpenRouter API key: [openrouter.ai/keys](https://openrouter.ai/keys)@@ -139,31 +370,40 @@ Some of the endpoints are marked as **Known,** which means they might have speci-## Anyscale-> Anyscale API key: [anyscale.com/credentials](https://app.endpoints.anyscale.com/credentials)++## Perplexity+> Perplexity API key: [perplexity.ai/settings/api](https://www.perplexity.ai/settings/api)**Notes:**-- **Known:** icon provided, fetching list of models is recommended.+- **Known:** icon provided.+- **Known issue:** fetching list of models is not supported.+- API may be strict for some models, and may not allow fields like `stop` and `frequency_penalty` may cause an error when set to 0, in which case, you should use [`dropParams`.](./custom_config.md#dropparams)+- The example includes a model list, which was last updated on February 27, 2024, for your convenience.```yaml- - name: "Anyscale"- apiKey: "${ANYSCALE_API_KEY}"- baseURL: "https://api.endpoints.anyscale.com/v1"+ - name: "Perplexity"+ apiKey: "${PERPLEXITY_API_KEY}"+ baseURL: "https://api.perplexity.ai/"models:default: [- "meta-llama/Llama-2-7b-chat-hf",+ "mistral-7b-instruct",+ "sonar-small-chat",+ "sonar-small-online",+ "sonar-medium-chat",+ "sonar-medium-online"]- fetch: true+ fetch: false # fetching list of models is not supportedtitleConvo: true- titleModel: "meta-llama/Llama-2-7b-chat-hf"+ titleModel: "sonar-medium-chat"summarize: false- summaryModel: "meta-llama/Llama-2-7b-chat-hf"+ summaryModel: "sonar-medium-chat"forcePrompt: false- modelDisplayLabel: "Anyscale"+ dropParams: ["stop", "frequency_penalty"]+ modelDisplayLabel: "Perplexity"```-+## ShuttleAI> ShuttleAI API key: [shuttleai.app/keys](https://shuttleai.app/keys)@@ -190,69 +430,7 @@ Some of the endpoints are marked as **Known,** which means they might have specidropParams: ["user"]```---## Fireworks-> Fireworks API key: [fireworks.ai/api-keys](https://fireworks.ai/api-keys)--**Notes:**--- **Known:** icon provided, fetching list of models is recommended.-- - API may be strict for some models, and may not allow fields like `user`, in which case, you should use [`dropParams`.](./custom_config.md#dropparams)--```yaml- - name: "Fireworks"- apiKey: "${FIREWORKS_API_KEY}"- baseURL: "https://api.fireworks.ai/inference/v1"- models:- default: [- "accounts/fireworks/models/mixtral-8x7b-instruct",- ]- fetch: true- titleConvo: true- titleModel: "accounts/fireworks/models/llama-v2-7b-chat"- summarize: false- summaryModel: "accounts/fireworks/models/llama-v2-7b-chat"- forcePrompt: false- modelDisplayLabel: "Fireworks"- dropParams: ["user"]-```----## Perplexity-> Perplexity API key: [perplexity.ai/settings/api](https://www.perplexity.ai/settings/api)--**Notes:**--- **Known:** icon provided.-- **Known issue:** fetching list of models is not supported.-- API may be strict for some models, and may not allow fields like `stop` and `frequency_penalty` may cause an error when set to 0, in which case, you should use [`dropParams`.](./custom_config.md#dropparams)-- The example includes a model list, which was last updated on February 27, 2024, for your convenience.--```yaml- - name: "Perplexity"- apiKey: "${PERPLEXITY_API_KEY}"- baseURL: "https://api.perplexity.ai/"- models:- default: [- "mistral-7b-instruct",- "sonar-small-chat",- "sonar-small-online",- "sonar-medium-chat",- "sonar-medium-online"- ]- fetch: false # fetching list of models is not supported- titleConvo: true- titleModel: "sonar-medium-chat"- summarize: false- summaryModel: "sonar-medium-chat"- forcePrompt: false- dropParams: ["stop", "frequency_penalty"]- modelDisplayLabel: "Perplexity"-```--+## together.ai> together.ai API key: [api.together.xyz/settings/api-keys](https://api.together.xyz/settings/api-keys)@@ -322,85 +500,3 @@ Some of the endpoints are marked as **Known,** which means they might have speciforcePrompt: falsemodelDisplayLabel: "together.ai"```-## LiteLLM-> LiteLLM API key: master_key value [LiteLLM](./litellm.md)--**Notes:**--- Reference [LiteLLM](./litellm.md) for configuration.--```yaml- - name: "LiteLLM"- apiKey: "sk-from-config-file"- baseURL: "http://localhost:8000/v1"- # if using LiteLLM example in docker-compose.override.yml.example, use "http://litellm:8000/v1"- models:- default: ["gpt-3.5-turbo"]- fetch: true- titleConvo: true- titleModel: "gpt-3.5-turbo"- summarize: false- summaryModel: "gpt-3.5-turbo"- forcePrompt: false- modelDisplayLabel: "LiteLLM"-```--## Ollama-> Ollama API key: Required but ignored - [Ollama OpenAI Compatibility](https://github.com/ollama/ollama/blob/main/docs/openai.md)--**Notes:**--- **Known:** icon provided.-- **Known issue:** fetching list of models is not supported. See [Pull Request 2728](https://github.com/ollama/ollama/pull/2728).-- Download models with ollama run command. See [Ollama Library](https://ollama.com/library)-- The example includes a top 5 popular model list from the Ollama Library, which was last updated on March 1, 2024, for your convenience.--```yaml- - name: "Ollama"- apiKey: "ollama"- # use 'host.docker.internal' instead of localhost if running LibreChat in a docker container- baseURL: "http://localhost:11434/v1/chat/completions"- models:- default: [- "llama2",- "mistral",- "codellama",- "dolphin-mixtral",- "mistral-openorca"- ]- fetch: false # fetching list of models is not supported- titleConvo: true- titleModel: "llama2"- summarize: false- summaryModel: "llama2"- forcePrompt: false- modelDisplayLabel: "Ollama"-```--!!! tip "Ollama -> llama3"-- To prevent the behavior where llama3 does not stop generating, add this `addParams` block to the config:-- ```yaml- - name: "Ollama"- apiKey: "ollama"- baseURL: "http://host.docker.internal:11434/v1/"- models:- default: [- "llama3"- ]- fetch: false # fetching list of models is not supported- titleConvo: true- titleModel: "llama3"- summarize: false- summaryModel: "llama3"- forcePrompt: false- modelDisplayLabel: "Ollama"- addParams:- "stop": [- "<|start_header_id|>",- "<|end_header_id|>",- "<|eot_id|>",- "<|reserved_special_token"- ]- ```\ No newline at end of filediff --git a/docs/install/configuration/custom_config.md b/docs/install/configuration/custom_config.mdindex e664ea4005..888e0b06c1 100644--- a/docs/install/configuration/custom_config.md+++ b/docs/install/configuration/custom_config.md@@ -619,6 +619,7 @@ endpoints:- "Mistral"- "OpenRouter"- "Groq"+ - APIpie- "Anyscale"- "Fireworks"- "Perplexity"diff --git a/packages/data-provider/src/config.ts b/packages/data-provider/src/config.tsindex 333e7a81b5..e2648d08f4 100644--- a/packages/data-provider/src/config.ts+++ b/packages/data-provider/src/config.ts@@ -244,16 +244,17 @@ export const configSchema = z.object({export type TCustomConfig = z.infer<typeof configSchema>;export enum KnownEndpoints {- mistral = 'mistral',- shuttleai = 'shuttleai',- openrouter = 'openrouter',- groq = 'groq',anyscale = 'anyscale',+ apipie = 'apipie',+ cohere = 'cohere',fireworks = 'fireworks',+ groq = 'groq',+ mistral = 'mistral',ollama = 'ollama',+ openrouter = 'openrouter',perplexity = 'perplexity',+ shuttleai = 'shuttleai','together.ai' = 'together.ai',- cohere = 'cohere',}export enum FetchTokenConfig {