Skip to content

feat: Add DeepSeek web (cookie-based) account support#3334

Closed
Zepp-Hanzj wants to merge 2 commits into
Wei-Shaw:mainfrom
Zepp-Hanzj:feat/deepseek-cookie-auth
Closed

feat: Add DeepSeek web (cookie-based) account support#3334
Zepp-Hanzj wants to merge 2 commits into
Wei-Shaw:mainfrom
Zepp-Hanzj:feat/deepseek-cookie-auth

Conversation

@Zepp-Hanzj

Copy link
Copy Markdown

feat: Add DeepSeek web (cookie-based) account support

Add support for DeepSeek accounts authenticated via browser cookies and tokens, enabling free API access through the DeepSeek web interface.

What's New

  • DeepSeek Cookie Auth: Create accounts using browser Authorization token + Cookie
  • PoW Challenge Solver: Keccak-based proof-of-work solver (DeepSeekHashV1) for anti-bot bypass
  • SSE Stream Converter: Translates DeepSeek's SSE format to OpenAI Chat Completions format
  • OpenAI-Compatible Gateway: DeepSeek requests go through the existing /v1/chat/completions endpoint
  • Multi-Model Support: Supports deepseek-chat, deepseek-v4-pro, deepseek-coder, deepseek-reasoner, deepseek-r1
  • Frontend UI: Account creation modal with Cookie/Token input, platform badge, and color theme

Architecture

Client → /v1/chat/completions → OpenAI Gateway → DeepSeek Handler
    → Create Session → Solve PoW → Call Completion → Convert SSE → Response

Files Changed

Category Files Summary
DeepSeek core 5 new files PoW solver, HTTP client, SSE converter, constants, gateway handler
Backend routing 9 modified Platform constants, gateway routing, account/group validation, service layer
Frontend 8 modified Account modals, types, colors, i18n, badge, groups view
Total 22 files +1343 / -29 lines

Testing

All models verified through Sub2API proxy in both stream and non-stream modes:

Model Non-stream Stream
deepseek-chat
deepseek-v4-pro
deepseek-coder
deepseek-reasoner
deepseek-r1

How to Use

  1. Go to Admin → Accounts → Create Account
  2. Select DeepSeek as platform type
  3. Enter Authorization token (from browser DevTools → Network → chat.deepseek.com request headers)
  4. Enter Cookie (from browser DevTools → Application → Cookies)
  5. Optionally specify a Model ID (defaults to deepseek-chat)
  6. Use the standard /v1/chat/completions endpoint with the DeepSeek account API key

Notes

  • DeepSeek PoW challenges are solved client-side to bypass rate limiting
  • The SSE stream converter handles DeepSeek's JSON Patch format and converts to OpenAI streaming format
  • Browser request headers are mimicked to avoid WAF (429) blocks
  • Token refresh requires manual re-entry (same as re-authenticating in browser)

Add support for DeepSeek accounts authenticated via browser cookies and
tokens, enabling free API access through the DeepSeek web interface.

Backend changes:
- Add deepseek package: PoW solver (Keccak), HTTP client, SSE stream converter
- Add gateway handler routing DeepSeek requests through OpenAI-compatible API
- Register DeepSeek platform in domain constants and validation whitelists
- Support account creation with Cookie/Token authentication
- Route /v1/chat/completions to DeepSeek handler when account is DeepSeek type

Frontend changes:
- Add DeepSeek Cookie/Token input fields in CreateAccountModal
- Hide generic API Key input for DeepSeek accounts in EditAccountModal
- Add DeepSeek platform badge, colors, and i18n entries
- Support DeepSeek in group creation platform selector

Tested with deepseek-chat, deepseek-v4-pro, deepseek-coder,
deepseek-reasoner, deepseek-r1 in both stream and non-stream modes.

Signed-off-by: hanzhijian <hanzhijian@zepp.com>
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@Zepp-Hanzj

Copy link
Copy Markdown
Author

Thank you for your contribution! Before we can merge this PR, we need you to sign our Contributor License Agreement (CLA).

To sign, please reply with the following comment:

I have read the CLA Document and I hereby sign the CLA

You only need to sign once — it will be valid for all your future contributions to this project.

I have read the CLA Document and I hereby sign the CLA

You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

I have read the CLA Document and I hereby sign the CLA

@Zepp-Hanzj

Copy link
Copy Markdown
Author

recheck

@Zepp-Hanzj

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Jun 18, 2026
Add search_enabled: true to the DeepSeek completion payload so that
the model can perform web searches for real-time information (weather,
news, etc.) just like the DeepSeek web interface.

Signed-off-by: hanzhijian <hanzhijian@zepp.com>
@Zepp-Hanzj Zepp-Hanzj force-pushed the feat/deepseek-cookie-auth branch from 78c64bd to bb19fb6 Compare June 18, 2026 03:32
@Zepp-Hanzj

Copy link
Copy Markdown
Author

Update: DeepSeek Web Search Support

Added search_enabled: true to the DeepSeek completion payload. This enables the model to perform web searches for real-time information, matching the behavior of the DeepSeek web interface.

Before: "我没有联网获取实时数据的能力"
After: Real-time weather, news, etc. with citations `[citation:N]

@Wei-Shaw

Copy link
Copy Markdown
Owner

不考虑合并。

@Wei-Shaw Wei-Shaw closed this Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants