mrsn0.3.0
auth
live

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.

2026-11-231 min read

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.

keyless search → 401
0.13s
measured 2026-11-02, twice
keyless fetch → 401
0.15s
21:04 / 21:05 UTC
the whole refusal
26 B
{"error":"Unauthorized"}
libs carry calls since
0.6.0
Python and JavaScript
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?

QuestionPublic 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]})
The catch: tools "can return thousands of tokens" per round. Ollama recommends ~32,000 tokens of context for serious loops, and its own example truncates each result to 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
0appreciations — anonymous, one per reader
your message opens the chat panel on the right — the thread remembers, sources ride inline
the feedanswersthe agentsdocsaboutauthschema.jsonopenapi.jsonllms.txt