Skip to content

[OpenCode Go] deepseek-v4-pro Anthropic proxy tool format broken: tools[0].function missing name #24224

Closed

Description

@superheroYu

Title:
[OpenCode Go] deepseek-v4-pro: tools[0].function missing name in Anthropic proxy
Body:

Description

When using Claude Code with OpenCode Go as the Anthropic-compatible proxy
(ANTHROPIC_BASE_URL: https://opencode.ai/zen/go), the deepseek-v4-pro model
fails with a 400 error on any request involving tool calls:
API Error: 400 {"error":{"message":"Error from provider (DeepSeek): Failed
to deserialize the JSON body into the target type: tools[0].function: missing
field name at line 1 column 30415","type":"invalid_request_error"}}

Root cause

Claude Code sends Anthropic-format tools (flat: {name, description, input_schema}).
OpenCode Go translates them to DeepSeek's OpenAI format (nested: {type: "function",
function: {name, description, parameters}}). The function.name field gets dropped
in the translation, causing DeepSeek to reject the request.

What works

  • Direct DeepSeek official API: works
  • MiniMax through OpenCode Go: works
  • Only deepseek-v4-pro and deepseek-v4-flash through Go fail

Steps to reproduce

  1. Configure Claude Code with ANTHROPIC_BASE_URL: https://opencode.ai/zen/go
  2. Set ANTHROPIC_MODEL: deepseek-v4-pro
  3. Send a prompt that triggers a tool call (read file, search, etc.)
  4. 400 error immediately

Environment

  • Windows 11 / PowerShell
  • Claude Code via OpenCode Go proxy

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 24, 2026
  2. github-actions commented on Apr 24, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  3. ringotypowriter commented on Apr 25, 2026

    @ringotypowriter

    It seems like Chat Completion work
    Even though the docs say using Anthropic.

  4. Shine12222 commented on Apr 25, 2026

    @Shine12222

    I have the same promble too.

  5. sh2 commented on Apr 25, 2026

    @sh2

    I am encountering the same issue.
    I am using GitHub Copilot CLI 1.0.36 on Ubuntu 24.04 LTS.
    In GitHub Copilot CLI, I have configured OpenCode Go's DeepSeek-V4-Flash as follows:

    COPILOT_PROVIDER_TYPE=anthropic
    COPILOT_PROVIDER_BASE_URL=https://opencode.ai/zen/go
    COPILOT_MODEL=deepseek-v4-flash
    COPILOT_PROVIDER_MAX_PROMPT_TOKENS=1000000
    COPILOT_PROVIDER_MAX_OUTPUT_TOKENS=384000

    Below is the error message from GitHub Copilot CLI:

    ❯ Hello,
    
    ● Request failed (transient_bad_request). Retrying...
    
    ● Request failed (transient_bad_request). Retrying...
    
    ✗ 400 {"error":{"message":"Error from provider (DeepSeek): Failed to deserialize the JSON body into the target type: 
      tools[0].function: missing field `name` at line 1 column 
      37386","type":"invalid_request_error","param":null,"code":"invalid_request_error"}}
    

    For reference, it works normally when using the official DeepSeek API instead of going through OpenCode Go.

    COPILOT_PROVIDER_TYPE=anthropic
    COPILOT_PROVIDER_BASE_URL=https://api.deepseek.com/anthropic
    COPILOT_MODEL=deepseek-v4-flash
    COPILOT_PROVIDER_MAX_PROMPT_TOKENS=1000000
    COPILOT_PROVIDER_MAX_OUTPUT_TOKENS=384000

    ❯ Hello,
    
    ● Hello! How can I help you today?
    
  6. wtq524176336-source commented on Apr 25, 2026

    @wtq524176336-source

    I have the same promble too.

  7. Senpaiarham04 commented on Apr 25, 2026

    @Senpaiarham04

    I have the same problem with using opencode go, with claude code cli, :(

  8. ixiqiu commented on Apr 26, 2026

    @ixiqiu

    I also ran into this problem, and I'm going to change it to an OpenAI compatible format and try it again

  9. superheroYu commented on Apr 28, 2026

    @superheroYu
    Author

    Quick update after re-checking the current OpenCode Go docs:

    This looks less like a simple tools[0].function.name serialization bug now, and more like a protocol mismatch.

    OpenCode Go currently documents deepseek-v4-pro and deepseek-v4-flash as OpenAI-compatible Chat Completions models:

    • endpoint: /v1/chat/completions
    • SDK/provider style: @ai-sdk/openai-compatible

    while the MiniMax M2.x models are the ones documented as Anthropic Messages-compatible:

    • endpoint: /v1/messages
    • SDK/provider style: @ai-sdk/anthropic

    So using Claude Code directly with OpenCode Go as an Anthropic-compatible ANTHROPIC_BASE_URL can break for DeepSeek V4: Claude Code sends Anthropic Messages/tool blocks, but the DeepSeek V4 path expects OpenAI-style chat completions, function/tool calls, and DeepSeek-specific reasoning_content replay in thinking/tool-call history.

    I made a small local workaround for this:

    https://github.com/superheroYu/deepseek-v4-opencode-claude-code-bridge.git

    It acts as a local Anthropic Messages -> OpenAI-compatible Chat Completions bridge for Claude Code + OpenCode Go + DeepSeek V4. It handles:

    • Anthropic /v1/messages to OpenAI-compatible /v1/chat/completions
    • tool_use / tool_result <-> OpenAI tool_calls / tool messages
    • streaming response conversion
    • DeepSeek V4 reasoning_content cache/replay for tool-call history
    • visible thinking block conversion for Claude Code

    Since this is now better understood as a protocol-compatibility gap rather than the original narrow tools[0].function.name issue, I’m going to close this issue. Hopefully the bridge helps anyone who wants to keep using DeepSeek V4 from OpenCode Go inside Claude Code in the meantime.

    References:

  10. added a commit that references this issue on May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)windows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions