`400 Error` Occured in Claude Code when invoke deepseek-v3.1 in Anthropic API
Error
When I switch my daily model to Deepseek-v3.1, this information shown on Claude Code interface:
API Error: 400 {"detail":"Error code: 400 - {'error': {'code':
'invalid_parameter_error', 'message': \"<400> InternalError.Algo.InvalidParameter: The
content field's type should be `str` in messages.\", 'param': None, 'type':
'invalid_request_error'}, 'request_id': '588a34a7-780e-4ff3-8d59-daaa0d9e4cc0'}"}
It works fine when I switch back to GLM-4.5. Then I tried OpenAI API on cherry studio using Deepseek-v3.1, no problem occured. The problem must be on Deepseek-v3.1 Anthropic API.
Claude Code settings
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"env": {
"ANTHROPIC_API_KEY": "ms-xxxxxxxxxxxxx",
"ANTHROPIC_BASE_URL": "https://api-inference.modelscope.cn",
"ANTHROPIC_MODEL": "deepseek-ai/DeepSeek-V3.1",
"ANTHROPIC_SMALL_FAST_MODEL": "Qwen/Qwen3-Coder-30B-A3B-Instruct"
},
"permissions": {
"allow": [
"Bash(uv run pytest:*)",
"Bash(grep:*)",
"Bash(findstr:*)",
"Bash(npm run typecheck:*)"
],
"deny": []
},
"feedbackSurveyState": {
"lastShownTime": 1754025289684
}
}
System
On Ubuntu-22.04 (WSL on Win11 24H2) Claude Code v1.0.92
the api-inference does not support input format of
"content": [{"type": "text", "text": "Hello"}]
it is being fixed.
should have been fixed. please try again
I have tried it agian, it still does't work. given the run code number 400.
It still there
API Error: 400 {"detail":"Error code: 400 - {'error': {'code':
'invalid_parameter_error', 'message': '<400> InternalError.Algo.InvalidParameter: The
tool call is not supported', 'param': None, 'type': 'invalid_request_error'},
'request_id': '1e9676af-8eb9-4bc6-8cc4-6d3d927dc643'}"}
It seems to be another bug, but it still doesn't work properly.
https://api-inference.modelscope.cn not Anthropic api, It should be configured with a tool like Claude code router
It still there
API Error: 400 {"detail":"Error code: 400 - {'error': {'code': 'invalid_parameter_error', 'message': '<400> InternalError.Algo.InvalidParameter: The tool call is not supported', 'param': None, 'type': 'invalid_request_error'}, 'request_id': '1e9676af-8eb9-4bc6-8cc4-6d3d927dc643'}"}
the original problem in this issued has been resolved. this new error is due to tool call not being supported for deepseek-v3.1 in api-inference.
the schedule to add support for tool use in deepseek-v3.1 would be evaluated separately.
It is the same for kimi-k2
我的win10系统 ,cc还是不支持3.1。只支持ds v3。希望官方尽快修复。 set ANTHROPIC_MODEL=deepseek-ai/DeepSeek-V3.1 set ANTHROPIC_BASE_URL=https://api-inference.modelscope.cn
API Error: 400 {"detail":"Error code: 400 - {'error': {'code': 'invalid_parameter_error', 'message': '<400> InternalError.Algo.InvalidParameter: The tool call is not supported', 'param': None, 'type': 'invalid_request_error'}, 'request_id': '106cd29d-4154-4552-b9b6-d6db965a12c6'}"}
API Error: 400 {"detail":"Error code: 400 - {'error': {'code': 'invalid_parameter_error', 'message': '<400> InternalError.Algo.InvalidParameter: The tool call is not supported', 'param': None, 'type': 'invalid_request_error'}, 'request_id': '106cd29d-4154-4552-b9b6-d6db965a12c6'}"} 这个问题确实一直有,还没修复吗
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.