modelscope icon indicating copy to clipboard operation
modelscope copied to clipboard

`400 Error` Occured in Claude Code when invoke deepseek-v3.1 in Anthropic API

Open TommrraraSnow opened this issue 1 year ago • 12 comments

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

TommrraraSnow avatar Aug 26 '25 01:08 TommrraraSnow

the api-inference does not support input format of

"content": [{"type": "text", "text": "Hello"}]

it is being fixed.

yingdachen avatar Aug 26 '25 09:08 yingdachen

should have been fixed. please try again

yingdachen avatar Aug 26 '25 14:08 yingdachen

I have tried it agian, it still does't work. given the run code number 400.

zhuangshuangyong avatar Aug 26 '25 14:08 zhuangshuangyong

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'}"}

TommrraraSnow avatar Aug 26 '25 15:08 TommrraraSnow

It seems to be another bug, but it still doesn't work properly.

TommrraraSnow avatar Aug 27 '25 01:08 TommrraraSnow

https://api-inference.modelscope.cn not Anthropic api, It should be configured with a tool like Claude code router

ipfred avatar Aug 27 '25 02:08 ipfred

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.

yingdachen avatar Aug 27 '25 03:08 yingdachen

It is the same for kimi-k2

h4rm00n avatar Aug 27 '25 13:08 h4rm00n

我的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'}"}

bleachgh avatar Aug 30 '25 08:08 bleachgh

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'}"} 这个问题确实一直有,还没修复吗

damxin avatar Sep 10 '25 14:09 damxin

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.

github-actions[bot] avatar Oct 11 '25 02:10 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Oct 16 '25 02:10 github-actions[bot]