Ollama web search API — the search isn't local
Ollama web search API lives at ollama.com, not on your machine. Shipped September 24, 2025 as web_search + web_fetch behind one account key; a keyless knock gets a 401 in 0.13s.
Ollama web search API calls run on ollama.com, not your box: mint a key, POST a query with a Bearer header, read JSON back. The weights stay home; the search rides their cloud into your context.
{"error":"Unauthorized"}Local means the weights, not the web.
How do I get an Ollama web search API key?
The key is an account setting, not a config flag — nothing to flip in ~/.ollama. Sign in, open Settings → Keys, export OLLAMA_API_KEY. Both endpoints read that one Bearer header.
curl https://ollama.com/api/web_search \--header "Authorization: Bearer $OLLAMA_API_KEY" \-d '{"query": "what is ollama?"}'
Shipped September 24, 2025: web_search and web_fetch, one account key. Fetch returns {title, content, links}.
What are the Ollama web search limits?
| Question | Public answer |
|---|---|
| Free tier? | Yes — with an account. Their words: "a generous free tier." |
| Higher limits? | Yes — paid ollama.com/cloud subscription. |
| Searches per minute / day? | Not published anywhere. |
| Results per call? | Tunable — the agent picks max_results. |
Searches-per-minute isn't published. That absence is the answer.
How do I give a local model web search?
Wire both calls as tools and let the model choose: six working lines, and a context tax ollama's own demo pays.
tools = {'web_search': web_search, 'web_fetch': web_fetch}
r = chat(model='qwen3:4b', messages=msgs, tools=[web_search, web_fetch], think=True)
for tc in r.message.tool_calls or []:
result = tools[tc.function.name](**tc.function.arguments)
msgs.append({'role': 'tool', 'content': str(result)[:8000]})2000 × 4 characters before reinjection.MCP, and the one key every client reads
Ollama ships an official MCP server example (web-search-mcp.py in the ollama-python repo), reachable over stdio from any client with the same key; Codex reads it from ~/.codex/config.toml.
{ "mcpServers": { "web_search_and_fetch": {
"command": "uv",
"args": ["run", "path/to/web-search-mcp.py"],
"env": { "OLLAMA_API_KEY": "your_key" } } } }- last tested 2026-11-02 — keyless reads at 21:04 / 21:05 UTC, 0.13s and 0.15s, twice; no key held on the bench
- https://ollama.com/api/web_search · https://ollama.com/api/web_fetch — key at ollama.com/settings/keys
- Python/JS libraries carry calls since 0.6.0 · ollama recommends qwen3 and gpt-oss for tool use