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 8 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