Skip to content

Anthropic hosted web_search options are not mapped onto Grok #123

Open

Description

@AlexanderKugel

Environment

claude-code-proxy live grok-claude instance, 127.0.0.1:18765
Claude Code 2.1.220, VS Code extension
provider: grok
model: grok-4.6
Grok client version (proxy header): 0.2.93

Problem

Claude Code sends Anthropic hosted web_search_20250305 options. The Grok path does not map them onto Grok hosted web_search.

Those options include allowed_domains, blocked_domains, user_location, and max_uses.

For domain lists and user_location, the proxy returns HTTP 400 before it calls Grok:

API Error: 400 Grok hosted web search does not support allowed_domains

Claude Code then retries the same search without the constraint. The search still runs, unrestricted, after an extra failed turn.

Also Grok does not support max_uses.

How to reproduce

Reliable replay against 127.0.0.1:18765:

curl -s -X POST 'http://127.0.0.1:18765/v1/messages?beta=true' \
  -H 'content-type: application/json' \
  -H 'anthropic-version: 2023-06-01' \
  -H 'authorization: Bearer unused' \
  -d '{
    "model": "grok-4.6",
    "max_tokens": 64,
    "stream": false,
    "messages": [{"role": "user", "content": "What are LangChain Deep Agents LangGraph 2026 tools"}],
    "tools": [{
      "type": "web_search_20250305",
      "name": "web_search",
      "max_uses": 8,
      "allowed_domains": ["langchain.com", "docs.langchain.com", "blog.langchain.com"]
    }]
  }'

Observed

  1. Hosted search with allowed_domains returns HTTP 400. Grok is not called.
  2. Claude Code presents the proxy error as a tool_result for the original WebSearch tool use, with is_error: true.
  3. On the next assistant turn, the model retries the same topic without allowed_domains.
  4. Those calls return search results.

Expected

The proxy maps Anthropic hosted-search options onto Grok where Grok has a matching field.

When Grok cannot enforce an option, the search still completes in one round. The request does not fail only for Claude Code to retry without the constraint.

Status: A fix is running in the fork AlexanderKugel/claude-code-proxy. A pull request will follow.

Activity

  1. changed the title [-]Grok hosted web search constraints cause a proxy 400, after which Claude Code retries without them[/-] [+]Anthropic hosted web_search options are not mapped onto Grok[/+] on Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions