ChatGPTNextWeb / ChatGPTNextWeb/NextChat

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

Open
#6,296 4 comments 1 reaction 0 assignees View on GitHub
bug
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.![Image](https://github.com/user-attachments/assets/2ce1355b-d65f-4bb0-b7f1-9fece223bc93)
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.

![Image](https://github.com/user-attachments/assets/9227fa00-14a2-4259-9f1a-ba2ee311c077)

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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.