ChatGPTNextWeb / ChatGPTNextWeb/NextChat
[Bug] Authentication Fails in NextChat + One-API Local Deployment When Using DeepSeek Official Model & API
- Dominant language
- TypeScript
- Stars
- 88.8k
- Forks
- 59.1k
- PR merge metrics
- No merged PRs in 30d
Description
### π¦ 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.
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](https://github.com/ChatGPTNextWeb/NextChat/issues/6286).
Other UI applications (e.g., Chatbox) work correctly with the same One-API setup, indicating that the issue is specific to NextChat's implementation.

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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.