GitHub Issue
Claude Code with DeepSeek Anthropic-compatible API fails during project analysis: Invalid user_id
## 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:
```text
API Error: 400 Invalid 'user_id': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9_-]+$'.
```
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 ...
View Raw Thread
Developer & User Discourse
Victor-ChanX • May 6, 2026
> check https://github.com/Agents365-ai/dsclaude I fixed it, it worked now
牛逼兄弟,但是这个官方我觉得应该也要重视一下吧
牛逼兄弟,但是这个官方我觉得应该也要重视一下吧
Agents365-ai • May 6, 2026
不知道是那边更新导致的,有可能是deepseek 有可能是claude code 更新导致的不兼容的一个小问题
Victor-ChanX • May 6, 2026
> 不知道是那边更新导致的,有可能是deepseek 有可能是claude code 更新导致的不兼容的一个小问题
使用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 的自己的模型名字
使用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 • May 7, 2026
我测试这个版本还可以
SaaS Metrics
I fixed it, it worked now