Skip to content

[FEATURE]:Support DeepSeek Native Web Search via Anthropic-Compatible API #32273

Closed as not planned

Description

@zhnsanso

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Feature Request: Support DeepSeek Native Web Search via Anthropic-Compatible API

Evidence: DeepSeek API Natively Supports Web Search

DeepSeek's official documentation at https://api-docs.deepseek.com/quick_start/agent_integrations/claude_code states:

Using Web Search in Claude Code

The DeepSeek API natively supports the Web Search feature in Claude Code.
When using Claude Code, if the model determines that your question requires
a web search, it will invoke the Web Search tool and perform the search
through the API provided by DeepSeek.

This feature is available through DeepSeek's Anthropic-compatible API endpoint (https://api.deepseek.com/anthropic), which speaks the Anthropic Messages protocol. It works via the server_tool_use / web_search_tool_result mechanism — the model invokes the search server-side, and DeepSeek handles the entire search lifecycle without any client-side tools or third-party services.

The Anthropic API compatibility matrix (https://api-docs.deepseek.com/guides/anthropic_api) confirms:

Message Field Variant Support Status
content array type = "server_tool_use" ✅ Supported
content array type = "web_search_tool_result" ✅ Supported

Problem: OpenCode Currently Cannot Use This Feature

OpenCode integrates DeepSeek exclusively as an OpenAI-compatible chat provider (@ai-sdk/openai-compatible with baseURL: https://api.deepseek.com/v1). The OpenAI Chat Completions protocol has no concept of provider-executed tools like web_search — it only supports client-executed tool_calls.

This means:

  • OpenCode users with a DeepSeek API key cannot access DeepSeek's native web search
  • The feature works on Claude Code (as documented), but not on OpenCode
  • Users must either use a separate search service or switch tools entirely

Root Cause

In packages/llm/src/providers/openai-compatible-profile.ts:10:

deepseek: { provider: "deepseek", baseURL: "https://api.deepseek.com/v1" }

DeepSeek is registered as an OpenAI-compatible provider, using OpenAIChat.protocol (packages/llm/src/protocols/openai-compatible-chat.ts:17-22). This protocol has no support for provider-defined tools like web_search.

However, OpenCode's Anthropic Messages protocol (packages/llm/src/protocols/anthropic-messages.ts) already fully supports web_search as a provider-defined tool:

  • Request lowering: converts web_search tool definitions → server_tool_use blocks (lines 281-303)
  • Response parsing: converts web_search_tool_result → tool-result events with providerExecuted: true (lines 614-636)
  • The V2 session runner already skips local dispatch for providerExecuted tools (packages/core/src/session/runner/llm.ts:256)

This infrastructure is ready — it just needs DeepSeek to be connected to it.

Proposed Approach

Add a Dual-Protocol Route for DeepSeek

Register DeepSeek as an Anthropic Messages provider in addition to its existing OpenAI-compatible route. When web_search is in the request's tool set, route through the Anthropic-compatible endpoint (https://api.deepseek.com/anthropic) instead of the default OpenAI-compatible one.

This is similar to the xai provider pattern in packages/llm/src/providers/xai.ts, which exposes both chat() (OpenAI Chat) and responses() (OpenAI Responses) methods from a single provider facade.

Files to Modify

File Change
packages/llm/src/providers/openai-compatible-profile.ts Add deepseekAnthropic profile with baseURL: "https://api.deepseek.com/anthropic" (3 lines)
packages/llm/src/providers/openai-compatible.ts Add anthropic() method for DeepSeek, using AnthropicMessages.route (reference: xAI dual-route pattern)
packages/opencode/src/session/llm/native-request.ts In the model() function (line 153), conditionally use Anthropic route when web_search is present (lines 165-178)
packages/opencode/src/tool/registry.ts Conditionally inject web_search tool definition into request.tools for DeepSeek Anthropic route
packages/core/src/session/runner/llm.ts Add web_search tool definition injection for DeepSeek at request.tools construction (lines 217-227)
packages/core/src/session/runner/model.ts Add model resolution path for DeepSeek Anthropic route (lines 84-117)

User Experience

  • User connects to DeepSeek via /connect as usual (no additional configuration)
  • All normal requests continue to use the OpenAI-compatible endpoint
  • When the model decides web search is needed, the request automatically uses the Anthropic endpoint
  • Only one DEEPSEEK_API_KEY is needed — no third-party services

References

Activity

  1. github-actions commented on Jun 14, 2026

    @github-actions
    Contributor

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

    Please review those issues to see if your request is already covered or can be tracked there.

  2. Senpaiarham04 commented on Jun 26, 2026

    @Senpaiarham04

    I would really appreciate it if you could add this feature. I can also assure you that it won't add much to your costs as a small business, because the web search is billed as usual—as a small number of tokens—through Deepseek, and they've made it very efficient. I really need to set up their web search; it would be a huge help.

  3. sinfor1 commented on Aug 1, 2026

    @sinfor1

    hey guys,I meet same problems.That why I am here.

    I find that opencode is f**king sh*t and no one responds
    Now I back to claude code and use codex

  4. maaoding commented on Aug 5, 2026

    @maaoding

    Update (2026-08-06): Both halves of this feature have now landed upstream — the remaining gap is a small wiring change in the built-in DeepSeek profile.

    1. DeepSeek officially shipped native web search (Jul 31, 2026)
    DeepSeek's official announcement (X/@deepseek_ai + changelog) for the V4-Flash official release confirms native web search support. The Anthropic-compatible endpoint (https://api.deepseek.com/anthropic) accepts server_tool_use blocks and returns web_search_tool_result — exactly the protocol path this issue asked for.

    2. OpenCode's runtime now handles provider-defined tools
    Since the V2 runner rework, provider-hosted tools pass through untouched: tool-calls with providerExecuted: true skip local dispatch (see "Provider-defined / hosted tools" in packages/llm/AGENTS.md). packages/llm/src/protocols/anthropic-messages.ts accepts web_search as a provider-defined tool and encodes results back as server_tool_use + web_search_tool_result blocks.

    3. What's still missing: the built-in DeepSeek profile is registered as OpenAI-compatible
    packages/llm/src/providers/openai-compatible-profile.ts still maps deepseek → https://api.deepseek.com/v1 (Chat Completions), and models.dev lists no tools capability for DeepSeek models. So out of the box, /connect deepseek still cannot expose web_search.

    Immediate workaround (works today): register DeepSeek as a custom Anthropic-protocol provider:

    // opencode.json
    {
      "provider": {
        "deepseek-anthropic": {
          "npm": "@ai-sdk/anthropic",
          "options": { "baseURL": "https://api.deepseek.com/anthropic" },
          "models": {
            "deepseek-v4-flash": { "name": "DeepSeek V4 Flash" }
          }
        }
      }
    }

    The Anthropic route lowers a declared web_search tool to server_tool_use and DeepSeek executes it server-side.

    Ask: can the built-in DeepSeek profile be switched to the Anthropic protocol (or models.dev updated to mark DeepSeek with web_search tools)? DeepSeek's own integration docs already recommend opencode >= v1.14.24 for their Anthropic-compatible API, so this looks like a small change that closes the issue.

  5. github-actions commented on Oct 6, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions