NextChat icon indicating copy to clipboard operation
NextChat copied to clipboard

[Bug] Authentication Fails in NextChat + One-API Local Deployment When Using DeepSeek Official Model & API

Open Yuwei9291 opened this issue 11 months ago • 4 comments

📦 Deployment Method

Docker

📌 Version

2.6.0

💻 Operating System

Windows

📌 System Version

win10

🌐 Browser

Chrome

📌 Browser Version

Latest

🐛 Bug Description

When deploying NextChat with One-API locally, an "Authentication Fails (no such user)" error occurs when attempting to use the DeepSeek official model. The issue arises because NextChat does not correctly route requests through One-API's gateway, instead attempting to directly call DeepSeek's API without using the One-API Token. Other UI applications (e.g., Chatbox) work correctly with the same setup.

Error Message:


JSON
{
  "error": {
    "message": "Authentication Fails (no such user)",
    "type": "authentication_error",
    "param": null,
    "code": "invalid_request_error"
  }
}

📷 Recurrence Steps

  1. Deploy NextChat and One-API locally.
  2. Add DeepSeek's API key and other channels (e.g., Alibaba's Tongyi Qianwen) in One-API.Image
  3. Configure NextChat's environment variables with the One-API token as follows: environment:
  • OPENAI_API_KEY=sk-dUJhlhHAabdVXsqN22B205Bxxxxxxxxxxxxx6e65B1Ad
  • CODE=xxxxx
  • BASE_URL=http://154.xxx.241.166:3000
  • CUSTOM_MODELS=-all,+deepseek-ai/DeepSeek-R1,+Pro/deepseek-ai/DeepSeek-R1,+deepseek-ai/DeepSeek-V3,+Pro/deepseek-ai/DeepSeek-V3,+deepseek-r1,+deepseek-v3,+qwen-max-latest,+deepseek-r1-250120,+deepseek-v3-241226,deepseek-chat,deepseek-reasoner
  • DEFAULT_MODEL=deepseek-chat

🚦 Expected Behavior

NextChat should route requests through One-API's gateway and successfully connect to the DeepSeek model using the One-API Token.

Actual Behavior: An "Authentication Fails (no such user)" error occurs. The logs indicate that NextChat is attempting to directly call DeepSeek's API without using the One-API Token.

📝 Additional Information

The issue is similar to a previously reported bug where NextChat failed to route requests correctly for the SiliconFlow model. Other UI applications (e.g., Chatbox) work correctly with the same One-API setup, indicating that the issue is specific to NextChat's implementation.

Image

Proposed Solution:

Ensure that NextChat correctly routes requests through One-API's gateway and uses the One-API Token for authentication. Verify that the BASE_URL and OPENAI_API_KEY environment variables are correctly configured in NextChat. Update NextChat's request handling logic to properly utilize One-API's gateway for all model requests.

Yuwei9291 avatar Feb 25 '25 09:02 Yuwei9291

➕ 1

ruoduan-hub avatar Feb 25 '25 13:02 ruoduan-hub

同样问题👀也是部署 one-api,看了日志发现调用 DeepSeek 官方的 API 地址去了。

Image

NextChat 聊天报错如下:

Image

按如下更换名称,报错又变了。

CUSTOM_MODELS="-all,+deepseek-chat@DeepSeek💰=DeepSeek-V3,+deepseek-reasoner@DeepSeek💰=DeepSeek-R1"

Image

KrDw9ec4 avatar Feb 26 '25 10:02 KrDw9ec4

同样的报错,通过one-api转发官方模型,以前是正常的,docker更新至v2.16.0(实际显示v2.15.8)后就不正常了。 后来在one-api中设置模型重定向就通了,CUSTOM_MODELS中不要指定@provider。

Image

Image

Image

robinspt avatar Mar 10 '25 15:03 robinspt

Bot detected the issue body's language is not English, translate it automatically.


The same error is reported, and the official model forwarding through one-api is normal before, but it is abnormal after docker is updated to v2.16.0 (actually displayed v2.15.8). Later, the model redirection is set in one-api and it will be enabled. Do not specify @provider in CUSTOM_MODELS.

Image

Image

Image

Issues-translate-bot avatar Mar 10 '25 15:03 Issues-translate-bot