mirror of
https://github.com/deepseek-ai/awesome-deepseek-agent.git
synced 2026-11-05 01:07:37 +00:00
[GH-ISSUE #67] Claude Code with DeepSeek Anthropic-compatible API fails during project analysis: Invalid user_id #22
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
deepseek-ai/awesome-deepseek-agent#22
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Victor-ChanX on GitHub (May 6, 2026).
Original GitHub issue: https://github.com/deepseek-ai/awesome-deepseek-agent/issues/67
Description
I encountered a compatibility issue when using Claude Code with DeepSeek's Anthropic-compatible API endpoint.
Claude Code can start successfully, and it works in a clean empty directory. However, when I run it inside a real project directory and ask it to read or analyse the codebase, it starts by searching/listing files and then fails during a subsequent API request with the following error:
Environment
Tool: Claude Code
API endpoint: https://api.deepseek.com/anthropic
Model: deepseek-v4-pro[1m]
OS: macOS
Usage scenario: Claude Code project-level code analysis
My environment variables are configured as follows:
export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_AUTH_TOKEN=sk-xxxx
export ANTHROPIC_MODEL='deepseek-v4-pro[1m]'
export ANTHROPIC_DEFAULT_OPUS_MODEL='deepseek-v4-pro[1m]'
export ANTHROPIC_DEFAULT_SONNET_MODEL='deepseek-v4-pro[1m]'
export ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-v4-flash
I also previously tested with:
export CLAUDE_CODE_SUBAGENT_MODEL=deepseek-v4-flash
export CLAUDE_CODE_EFFORT_LEVEL=max
But the issue still appears after disabling these two variables.
Steps to reproduce
Configure Claude Code to use DeepSeek's Anthropic-compatible endpoint.
Run Claude Code in a clean empty directory.
It starts successfully.
Run Claude Code inside an actual code project.
Ask Claude Code to read or analyse the project code, for example:
Please read this codebase and explain how it works.
Claude Code starts file search/listing operations.
The request then fails with:
API Error: 400 Invalid 'user_id': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9_-]+$'.
What I have already tried
I have tried the following:
Cleared global Claude Code configuration and cache.
Removed local project-level .claude configuration.
Removed .mcp.json and mcp-server.json.
Disabled Claude Code plugins.
Disabled MCP-related configuration.
Removed Claude Code backups and old project history.
Tested in a clean directory, where Claude Code can start successfully.
Tested again in the real project directory, where the error happens during codebase analysis.
Because the clean directory works but project-level analysis fails, it seems that the issue may be triggered by the request generated during Claude Code's tool/codebase workflow.
Expected behaviour
Claude Code should be able to continue project-level code analysis through DeepSeek's Anthropic-compatible endpoint without the Invalid user_id error.
Actual behaviour
Claude Code starts normally, performs some file search/listing operations, and then the API request fails with a 400 error:
Invalid 'user_id': string does not match pattern.
Possible cause
This may be related to how the DeepSeek Anthropic-compatible endpoint handles Claude Code requests involving tool calls, project context, session metadata, or user identification fields.
The error message mentions user_id, but I could not find any invalid user_id in my local Claude Code configuration. It is possible that some field generated by Claude Code during project analysis is being interpreted or validated as user_id by the compatibility layer.
Related reference
There is a similar Claude Code issue where invalid tool/MCP names caused a pattern validation error:
https://github.com/anthropics/claude-code/issues/858
Although my error is shown as user_id, the behaviour seems similar in that a field generated during Claude Code execution may not match the expected pattern.
Request
Could you please confirm whether DeepSeek's Anthropic-compatible API fully supports the current Claude Code request format, especially during project-level code analysis involving tool calls?
If this is a known compatibility issue, could you provide a recommended workaround, such as:
a specific Claude Code version,
a recommended DeepSeek model setting,
environment variables to disable certain Claude Code features,
or guidance on which request fields need to be sanitised?
Thank you.
@Agents365-ai commented on GitHub (May 6, 2026):
check https://github.com/Agents365-ai/dsclaude
I fixed it, it worked now
@Victor-ChanX commented on GitHub (May 6, 2026):
牛逼兄弟,但是这个官方我觉得应该也要重视一下吧
@Agents365-ai commented on GitHub (May 6, 2026):
不知道是那边更新导致的,有可能是deepseek 有可能是claude code 更新导致的不兼容的一个小问题
@Victor-ChanX commented on GitHub (May 6, 2026):
使用dsclaude-desktop还是报错
Your provider setup needs a fix
Some required fields are missing or malformed. Open Setup to finish configuring it.
Details
用你的提供的脚本,我查看了一下仔细的报错,现在 claude code desktop 好像只只支持 claude 的自己的模型名字
@Agents365-ai commented on GitHub (May 7, 2026):
@Agents365-ai commented on GitHub (May 7, 2026):
@Agents365-ai commented on GitHub (May 7, 2026):
目前应该已经恢复了
@Agents365-ai commented on GitHub (May 7, 2026):