#Claude with web search tool throws 500 after streaming citations

3 messages · Page 1 of 1 (latest)

wraith heron
#

Has anyone gotten the web search tool working with claude models?
https://openrouter.ai/docs/guides/features/server-tools/web-search

I always get code 500 with the message "Server tool request failed".
Qwen, Gemini and all other models i tested work fine, just Claude models are failing.

Weirdly, i get multiple responses with citations from the web that look like so:

{
    'id': 'xyz123',
    'object': 'chat.completion.chunk',
    'created': 123,
    'model': 'anthropic/claude-4.6-sonnet-20260217',
    'provider': 'OpenAI',
    'choices': [{
            'index': 0,
            'delta': {
                'content': '',
                'role': 'assistant',
                'annotations': [{
                        'type': 'url_citation',
                        'url_citation': {
                            'url': 'https://www.page.de',
                            'title': 'Page title',
                            'start_index': 0,
                            'end_index': 0,
                            'content': 'bla bla foo bar'
                        }
                    }
                ]
            },
            'finish_reason': None,
            'native_finish_reason': None
        }
    ]
}

But after the citations are streamed, OpenRouter returns an error:

{
    'id': 'xyz123',
    'object': 'chat.completion.chunk',
    'created': 123,
    'model': 'anthropic/claude-4.6-sonnet-20260217',
    'provider': 'OpenAI',
    'choices': [],
    'error': {
        'code': 500,
        'message': 'Server tool request failed',
        'metadata': {
            'error_type': 'server'
        }
    }
}

Has anyone gotten it to work with claude?

OpenRouter Documentation

Add real-time web search to any model on OpenRouter. The model decides when to search, OpenRouter executes it, and results are returned with citations.

#

Claude with web search tool throws 500 after streaming citations

#

My requests look like so:

{
    'stream': True,
    'model': 'anthropic/claude-sonnet-4.6',
    'messages': [{
            'role': 'user',
            'content': 'Wie wird das Wetter heute?'
        }
    ],
    'tools': [{
            'type': 'openrouter:web_search',
            'parameters': {
                'max_results': 4,
                'max_total_results': 12
            }
        }
    ],
    'provider': {
        'zdr': True
    },
    'reasoning': {
        'effort': 'none'
    }
}