From 60005b0d0b05c673b7994f3b6b72df8d0cb39a1f Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Tue, 21 Jan 2025 09:19:10 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=8B=20docs:=20Deepseek=20Example=20&?= =?UTF-8?q?=20Token=20Usage=20Docker=20Commands=20(#201)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: enhance authentication and token usage documentation with deployment context * feat: add deepseek example --- .../content/v0.7.0-breaking-changes.mdx | 1 + components/repeated/AdditionalLinks.mdx | 2 +- next.config.mjs | 6 ++ .../configuration/authentication/index.mdx | 8 +-- pages/docs/configuration/dotenv.mdx | 1 + .../librechat_yaml/ai_endpoints/deepseek.mdx | 33 +++++++++ .../object_structure/custom_endpoint.mdx | 1 + pages/docs/configuration/token_usage.mdx | 69 ++++++++++++++++--- pages/docs/features/index.mdx | 1 + pages/docs/quick_start/index.mdx | 2 +- 10 files changed, 110 insertions(+), 14 deletions(-) create mode 100644 pages/docs/configuration/librechat_yaml/ai_endpoints/deepseek.mdx diff --git a/components/changelog/content/v0.7.0-breaking-changes.mdx b/components/changelog/content/v0.7.0-breaking-changes.mdx index f4afe30..20330bb 100644 --- a/components/changelog/content/v0.7.0-breaking-changes.mdx +++ b/components/changelog/content/v0.7.0-breaking-changes.mdx @@ -63,6 +63,7 @@ CONSOLE_JSON=false # FIREWORKS_API_KEY= # PERPLEXITY_API_KEY= # TOGETHERAI_API_KEY= +# DEEPSEEK_API_KEY= ``` ```sh filename="✨ Update Anthropic models" diff --git a/components/repeated/AdditionalLinks.mdx b/components/repeated/AdditionalLinks.mdx index 2623c71..44dceb3 100644 --- a/components/repeated/AdditionalLinks.mdx +++ b/components/repeated/AdditionalLinks.mdx @@ -7,7 +7,7 @@ Explore more about LibreChat and how to configure it to your needs. - **[Configuring AI Providers](/docs/configuration/pre_configured_ai)** - Configure OpenAI, Google, Anthropic, and OpenAI Assistants - **[Configuring a Custom Endpoint](./custom_endpoints)** - - Configure services such as OpenRouter, Ollama, Mistral AI, Databricks, groq, and others. + - Configure services such as Deepseek, OpenRouter, Ollama, Mistral AI, Databricks, groq, and others. - **[Click here](/docs/configuration/librechat_yaml/ai_endpoints)** for a list of known, compatible services. - **[Environment Configuration](/docs/configuration/dotenv)** - Read for a comprehensive look at the `.env` file. diff --git a/next.config.mjs b/next.config.mjs index d9453e0..8f036e5 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -92,6 +92,12 @@ const nextraConfig = withNextra({ port: '', pathname: '/**', }, + { + protocol: 'https', + hostname: 'firebasestorage.googleapis.com', + port: '', + pathname: '/**', + }, ], }, headers() { diff --git a/pages/docs/configuration/authentication/index.mdx b/pages/docs/configuration/authentication/index.mdx index 0f1141f..4123cb2 100644 --- a/pages/docs/configuration/authentication/index.mdx +++ b/pages/docs/configuration/authentication/index.mdx @@ -104,12 +104,12 @@ To set up the mod system, review [the setup guide](/docs/configuration/mod_syste The create-user script allows you to add users directly to the database, even when registration is disabled. Here's how to use it: -1. For the default docker-compose.yml: +1. For the default `docker-compose.yml` (if you use `docker compose up` to start the app): ``` docker-compose exec api npm run create-user ``` -2. For the deploy-compose.yml: +2. For the `deploy-compose.yml` (if you followed the [Ubuntu Docker Guide](/docs/remote/docker_linux)): ``` docker exec -it LibreChat-API /bin/sh -c "cd .. && npm run create-user" ``` @@ -125,12 +125,12 @@ Follow the prompts to enter the new user's email and password. To delete a user, you can use the delete-user script: -1. For the default docker-compose.yml: +1. For the default `docker-compose.yml` (if you use `docker compose up` to start the app): ``` docker-compose exec api npm run delete-user email@domain.com ``` -2. For the deploy-compose.yml: +2. For the `deploy-compose.yml` (if you followed the [Ubuntu Docker Guide](/docs/remote/docker_linux)): ``` docker exec -it LibreChat-API /bin/sh -c "cd .. && npm run delete-user email@domain.com" ``` diff --git a/pages/docs/configuration/dotenv.mdx b/pages/docs/configuration/dotenv.mdx index 68bb56d..6a6e5e7 100644 --- a/pages/docs/configuration/dotenv.mdx +++ b/pages/docs/configuration/dotenv.mdx @@ -214,6 +214,7 @@ Uncomment `ENDPOINTS` to customize the available endpoints in LibreChat. ['PERPLEXITY_API_KEY', 'string', 'API key for Perplexity.', '# PERPLEXITY_API_KEY='], ['SHUTTLEAI_API_KEY', 'string', 'API key for ShuttleAI.', '# SHUTTLEAI_API_KEY='], ['TOGETHERAI_API_KEY', 'string', 'API key for TogetherAI.', '# TOGETHERAI_API_KEY='], + ['DEEPSEEK_API_KEY', 'string', 'API key for Deepseek API', '# DEEPSEEK_API_KEY='], ]} /> diff --git a/pages/docs/configuration/librechat_yaml/ai_endpoints/deepseek.mdx b/pages/docs/configuration/librechat_yaml/ai_endpoints/deepseek.mdx new file mode 100644 index 0000000..6691ea1 --- /dev/null +++ b/pages/docs/configuration/librechat_yaml/ai_endpoints/deepseek.mdx @@ -0,0 +1,33 @@ +--- +title: Deepseek +description: Example configuration for Deepseek API +--- + +import Image from 'next/image' + +# [Deepseek](https://www.deepseek.com/) + +> Deepseek API key: [platform.deepseek.com](https://platform.deepseek.com/usage) + +**Notes:** + +- **Known:** icon provided. +- `deepseek-chat` and `deepseek-coder` are compatible with [Agents + tools](/docs/features/agents). +- `deepseek-reasoner`, codenamed "R1," is supported and will stream its "thought process"; however, certain OpenAI API parameters may not be supported by this specific model. +- "R1" may also be compatible with Agents when not using tools. +- `deepseek-chat` is preferred for title generation. + +```yaml filename="librechat.yaml" + - name: "Deepseek" + apiKey: "${DEEPSEEK_API_KEY}" + baseURL: "https://api.deepseek.com/v1" + models: + default: ["deepseek-chat", "deepseek-coder", "deepseek-reasoner"] + fetch: false + titleConvo: true + titleModel: "deepseek-chat" + modelDisplayLabel: "Deepseek" +``` + +Deepseek Generation + diff --git a/pages/docs/configuration/librechat_yaml/object_structure/custom_endpoint.mdx b/pages/docs/configuration/librechat_yaml/object_structure/custom_endpoint.mdx index 3e027af..684b95f 100644 --- a/pages/docs/configuration/librechat_yaml/object_structure/custom_endpoint.mdx +++ b/pages/docs/configuration/librechat_yaml/object_structure/custom_endpoint.mdx @@ -111,6 +111,7 @@ iconURL: https://github.com/danny-avila/LibreChat/raw/main/docs/assets/LibreChat - "openAI" | "azureOpenAI" | "google" | "anthropic" | "assistants" | "gptPlugins" * There are also "known endpoints" (case-insensitive), which have icons provided. If your endpoint `name` matches the following names, you should omit this field: - "Mistral" + - "Deepseek" - "OpenRouter" - "groq" - "APIpie" diff --git a/pages/docs/configuration/token_usage.mdx b/pages/docs/configuration/token_usage.mdx index 43eb1be..2c3048e 100644 --- a/pages/docs/configuration/token_usage.mdx +++ b/pages/docs/configuration/token_usage.mdx @@ -4,6 +4,8 @@ description: This covers how to track and control your token usage for the OpenA --- # Token Usage +## Intro + As of `v6.0.0`, LibreChat accurately tracks token usage for the OpenAI/Plugins endpoints. This can be viewed in your database's "Transactions" collection. @@ -25,34 +27,85 @@ And You can also set the number of tokens a user will receive upon registration: ]} /> +You're right. Let me combine both styles, maintaining the clarity of the original content while adding the deployment context: + +## Managing Token Balances + You manually add user balance, or you will need to build out a balance-accruing system for users. This may come as a feature to the app whenever an admin dashboard is introduced. -```bash filename="To manually add balances, run the following command (npm required):" +These commands vary depending on your deployment method: +- **Local Development**: +Run from the project root directory when running the application locally without Docker +- **Docker (default setup)**: +Run from the directory containing your `docker-compose.yml` when using the default Docker setup (typically started with `docker compose up`) +- **Docker (deployment setup)**: +Run from the directory containing your `deploy-compose.yml` if you followed the [Ubuntu Docker Guide](/docs/remote/docker_linux) + +### Adding Balances + +```bash filename="To manually add balances, run the following command:" +# Local Development npm run add-balance + +# Docker (default setup) +docker-compose exec api npm run add-balance + +# Docker (deployment setup) +docker exec -it LibreChat-API /bin/sh -c "cd .. && npm run add-balance" ``` ```bash filename="You can also specify the email and token credit amount to add, e.g.:" +# Local Development npm run add-balance danny@librechat.ai 1000 + +# Docker (default setup) +docker-compose exec api npm run add-balance danny@librechat.ai 1000 + +# Docker (deployment setup) +docker exec -it LibreChat-API /bin/sh -c "cd .. && npm run add-balance danny@librechat.ai 1000" ``` +### Setting Balances + Additionally, you can set a balance for a user. An existing balance will be overwritten by the new balance. -```bash filename="To manually set balances, run the following command (npm required):" +```bash filename="To manually set balances, run the following command:" +# Local Development npm run set-balance + +# Docker (default setup) +docker-compose exec api npm run set-balance + +# Docker (deployment setup) +docker exec -it LibreChat-API /bin/sh -c "cd .. && npm run set-balance" ``` ```bash filename="You can also specify the email and token credit amount to set, e.g.:" +# Local Development npm run set-balance danny@librechat.ai 1000 + +# Docker (default setup) +docker-compose exec api npm run set-balance danny@librechat.ai 1000 + +# Docker (deployment setup) +docker exec -it LibreChat-API /bin/sh -c "cd .. && npm run set-balance danny@librechat.ai 1000" +``` + +### Listing of balances + +```bash filename="To see the balances of your users, you can run:" +# Local Development +npm run list-balances + +# Docker (default setup) +docker-compose exec api npm run list-balances + +# Docker (deployment setup) +docker exec -it LibreChat-API /bin/sh -c "cd .. && npm run list-balances" ``` This works well to track your own usage for personal use; 1000 credits = $0.001 (1 mill USD) -## Listing of balances - -```bash filename="To see the balances of your users, you can run:" -npm run list-balances -``` - ## Notes - With summarization enabled, you will be blocked from making an API request if the cost of the content that you need to summarize + your messages payload exceeds the current balance diff --git a/pages/docs/features/index.mdx b/pages/docs/features/index.mdx index 43c9d1e..eadf565 100644 --- a/pages/docs/features/index.mdx +++ b/pages/docs/features/index.mdx @@ -59,6 +59,7 @@ import Image from 'next/image' #### **Remote & Local Integration** - **Groq**: Fast, efficient AI inference with custom processors +- **Deepseek**: Cutting-edge Open-source AI models - **Ollama**: Generative AI models for interactive applications and chatbots. - **Cohere**: Natural language processing APIs for business applications. - **Mistral AI**: Open-source high-performance generative AI. diff --git a/pages/docs/quick_start/index.mdx b/pages/docs/quick_start/index.mdx index 40204da..0d8572a 100644 --- a/pages/docs/quick_start/index.mdx +++ b/pages/docs/quick_start/index.mdx @@ -8,4 +8,4 @@ Use this easy setup guide and start using LibreChat as quickly as possible. #### [Custom Endpoints](./quick_start/custom_endpoints) -Configure custom endpoints for services like OpenRouter, Ollama, Mistral AI, Databricks, groq, and others. +Configure custom endpoints for services like OpenRouter, Deepseek, Ollama, Mistral AI, groq, Databricks, and others.