Web Search
Let Claude search the web server-side using Anthropic's web_search server tool.
Web search is not a separate endpoint. Instead, add Anthropic's web_search
server tool to a regular POST /v1/messages request. The model runs searches
server-side and cites the results in its response. Claude models only.
Example
curl https://api.tokapi.ai/v1/messages \
-H "Authorization: Bearer sk-lazytech-..." \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 1024,
"messages": [{ "role": "user", "content": "What is the latest Node.js LTS version?" }],
"tools": [{ "type": "web_search_20250305", "name": "web_search", "max_uses": 5 }]
}'Notes
- Each search counts as server tool use and is metered like other usage.
- Only Claude models support the
web_searchserver tool. - The response includes a
server_tool_useentry in itsusageobject so you can see how many searches were performed.
See Usage API to track your consumption.