<!-- llms-explorer concept facts · https://llms-explorer.com/tree/ollama-web-search-and-web-fetch-api/ · pack 2026-10-14 · ~4046 tokens -->

# Ollama web search and web fetch API

> web_search is POST https://ollama.com/api/web_search with required string `query` and optional integer `max_results` (default 5, max 10). The response is an object whose `results` array holds items with `title`, `url` and `content` (a snippet). (from docs.ollama.com)

Parent: [Ollama deployment, cloud, security and operations](https://llms-explorer.com/tree/ollama-deployment-cloud-security-and-operations/) · 6 facets · 66 facts · page: https://llms-explorer.com/tree/ollama-web-search-and-web-fetch-api/

## Definitions

- Ollama web search is a hosted API feature that returns search results or fetched page content for applications that need current information. It is separate from local model inference and requires an Ollama account API key. — [source](https://www.simplified.guide/_export/xhtml/ollama/api-use-web-search)

## How it works

- Fetch a single page when the application needs page content. $ curl https://ollama.com/api/web_fetch \ -H "Authorization: Bearer $OLLAMA_API_KEY" \ -d '{"url":"https://docs.ollama.com/"}' {"title":"Ollama documentation","content":"##### snipped #####","links":[##### snipped #####]} — [source](https://www.simplified.guide/_export/xhtml/ollama/api-use-web-search)
- A community Reddit report says a 401 on web search, seen when building Ollama from source, went away once the OLLAMA_API_KEY environment variable took precedence over the SSH-key signing path. This is a single unverified report. — [source](https://reddit.sentinel-team.org/posts/1s0ywmp/snapshots/2026-03-23T07%3A15%3A14.54713Z)

## How-to and procedures

- Local-only mode: set `disable_ollama_cloud: true` in ~/.ollama/server.json or export OLLAMA_NO_CLOUD=1, then restart. This disables Ollama cloud models and web search, and the logs show `Ollama cloud disabled: true`. — [source](https://docs.ollama.com/faq)
- The official FAQ lets operators run local-only by setting OLLAMA_NO_CLOUD=1 or `disable_ollama_cloud: true` in ~/.ollama/server.json, which removes cloud models and web search and logs 'Ollama cloud disabled: true'. — [source](https://docs.ollama.com/faq)
- Ollama can run in local only mode by disabling Ollama's cloud features. By turning off Ollama's cloud features, you will lose the ability to use Ollama's cloud models and web search. — [source](https://docs.ollama.com/faq#how-do-i-disable-ollama-s-cloud-features)
- Use Ollama’s web search as a tool to build a mini search agent. — [source](https://ollama.com/blog/web-search)
- Use Ollama’s web search API as a tool to build a mini search agent. This example uses Alibaba’s Qwen 3 model with 4B parameters. — [source](https://docs.ollama.com/capabilities/web-search)
- Use Ollama's web search API from Claude Code. — [source](https://docs.ollama.com/integrations/claude-code#web-search)
- To fetch individual pages (e.g. when a user provides a url in the prompt), use the new web fetch API. — [source](https://ollama.com/blog/web-search)

## Examples and snippets

- ```bash theme={"system"} — `curl https://ollama.com/api/web_search \` … — [source](https://docs.ollama.com/capabilities/web-search#curl-request)
- ```python theme={"system"} — `curl --request POST \` … — [source](https://docs.ollama.com/capabilities/web-search#curl-request)
- ```python theme={"system"} — `from ollama import chat, web_fetch, web_search` … — [source](https://docs.ollama.com/capabilities/web-search#building-a-search-agent)
- ```python theme={"system"} — `import ollama` … — [source](https://docs.ollama.com/capabilities/web-search#python-library)
- ```tsx theme={"system"} — `import { Ollama } from "ollama";` … — [source](https://docs.ollama.com/capabilities/web-search#javascript-library)
- ```tsx theme={"system"} — `import { Ollama } from "ollama";` … — [source](https://docs.ollama.com/capabilities/web-search#javascript-sdk)
- ```python theme={"system"} — `from ollama import web_fetch` … — [source](https://docs.ollama.com/capabilities/web-search#python-sdk)

## Problems, failure modes and limitations

- The official docs list no numeric rate limits, quotas, HTTP error codes or content size limits for web_search/web_fetch. Third-party aggregator pages claim cloud limits are tier-based concurrency (Free 1, Pro 3, Max 10 cloud models) and 5-hour/7-day usage windows, but these concern cloud model inference, not necessarily the search endpoints. — [source](https://apis.io/rate-limits/ollama/ollama-rate-limits/)
- Because the endpoints are hosted on ollama.com, any host calling them needs outbound internet access and an account key. Search query text and fetched URLs leave the local network, so air-gapped or egress-restricted deployments cannot use them. — [source](https://docs.ollama.com/capabilities/web-search)
- The search endpoint runs at https://ollama.com/api/web_search and accepts a query plus an optional result limit. Treat returned snippets as retrieval context that still needs citation, filtering, or summarization in the application layer. — [source](https://www.simplified.guide/_export/xhtml/ollama/api-use-web-search)

## Facts and statements

- Verify hosted web search returns results with a bearer token. $ curl https://ollama.com/api/web_search \ -H "Authorization: Bearer $OLLAMA_API_KEY" \ -d '{"query":"what is ollama?","max_results":3}' {"results":[{"title":"Ollama","url":"https://ollama.com/","content":"Cloud models are now available..."}]} — [source](https://www.simplified.guide/_export/xhtml/ollama/api-use-web-search)
- Keep result count small for prompt injection review. $ curl https://ollama.com/api/web_search -H "Authorization: Bearer $OLLAMA_API_KEY" -d '{"query":"site:docs.ollama.com embeddings","max_results":2}' {"results":[##### snipped #####]} — [source](https://www.simplified.guide/_export/xhtml/ollama/api-use-web-search)
- Search and fetch results can be thousands of tokens. Ollama recommends raising the model context length to at least ~32000 tokens, and says its cloud models run at full context length. The official example agent uses qwen3:4b with think=True and truncates each tool output to 2000*4 characters. — [source](https://docs.ollama.com/capabilities/web-search)
- web_search is POST https://ollama.com/api/web_search with required string `query` and optional integer `max_results` (default 5, max 10). The response is an object whose `results` array holds items with `title`, `url` and `content` (a snippet). — [source](https://docs.ollama.com/capabilities/web-search)
- Both endpoints are hosted on ollama.com, not on a local Ollama server, and need an API key created at ollama.com/settings/keys from a free account. The key goes in the OLLAMA_API_KEY environment variable or an `Authorization: Bearer` header. — [source](https://docs.ollama.com/capabilities/web-search)
- curl https://ollama.com/api/web_search \ --header "Authorization: Bearer $OLLAMA_API_KEY" \ -d '{ "query": "what is ollama?" }' — [source](https://ollama.com/blog/web-search)
- curl --request POST \ --url https://ollama.com/api/web_fetch \ --header "Authorization: Bearer $OLLAMA_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "url": "ollama.com" }' — [source](https://ollama.com/blog/web-search)
- web_fetch is POST https://ollama.com/api/web_fetch with required string `url`. The response has `title`, `content` (main page content) and `links` (links found on the page). — [source](https://docs.ollama.com/capabilities/web-search)
- Ollama ships a Python MCP server (web-search-mcp.py in the ollama-python repo) that exposes web search to any MCP client. Docs show config for Cline and Codex (command uv, with OLLAMA_API_KEY in env). Goose is shown only in screenshots. — [source](https://docs.ollama.com/capabilities/web-search)
- Choose a [cloud model](https://ollama.com/search?c=cloud). The cloud API does not support stateful Responses, built-in web search through `/v1/responses`, or custom/freeform tool-call replay. — [source](https://docs.ollama.com/api/openai-compatibility#direct-cloud-access)
- Codex web-search requests sent through the Ollama profile are executed by Ollama for both local and cloud models. Sign in with `ollama signin` to use the web-search service. — [source](https://docs.ollama.com/integrations/codex#web-search-through-local-ollama)
- Web search is enabled automatically. It requires access to Ollama's cloud and a model that supports tools. Run `ollama signin` if needed. — [source](https://docs.ollama.com/integrations/deepseek-harness#web-search)
- <Note>Ollama web search for local models requires `ollama signin`.</Note> — [source](https://docs.ollama.com/integrations/openclaw#web-search-and-fetch)
- Web search and fetch were announced 2025-09-24. The announcement calls the free tier generous for individuals and says higher rate limits come with Ollama's cloud subscription. It gives no numbers. — [source](https://ollama.com/blog/web-search)
- Returned snippets are untrusted retrieval context, so the application must handle citation, filtering and prompt-injection review. One third-party guide advises keeping max_results small to make that review tractable, and a task-scoped key that is rotated after testing and never stored in a repo. — [source](https://www.simplified.guide/_export/xhtml/ollama/api-use-web-search)
- The Python library (`ollama>=0.6.0`) exposes `ollama.web_search(query)` and `ollama.web_fetch(url)`, the latter returning a WebFetchResponse. The JavaScript library (`ollama@>=0.6.0`) exposes `client.webSearch()` and `client.webFetch()`. Both SDKs can pass the functions as tools to chat(). — [source](https://docs.ollama.com/capabilities/web-search)
- The official example agent loop is `while True` with no iteration cap and no exception handling, and it passes model-supplied arguments straight to the tool. A production agent needs a loop cap, argument validation and try/except around tool calls. — [source](https://github.com/ollama/ollama-python/blob/main/examples/web-search.py)
- POST https://ollama.com/api/web_search — [source](https://docs.ollama.com/capabilities/web-search)
- POST https://ollama.com/api/web_fetch — [source](https://docs.ollama.com/capabilities/web-search)
- Web search results can return thousands of tokens. It is recommended to increase the context length of the model to at least ~32000 tokens. Search agents work best with full context length. Ollama’s cloud models run at the full context length. — [source](https://docs.ollama.com/capabilities/web-search)
- `POST https://ollama.com/api/web_search` — [source](https://docs.ollama.com/capabilities/web-search#request)
- `POST https://ollama.com/api/web_fetch` — [source](https://docs.ollama.com/capabilities/web-search#request)
- Web search results can return thousands of tokens. It is recommended to increase the context length of the model to at least \~32000 tokens. Search agents work best with full context length. [Ollama's cloud models](https://docs.ollama.com/cloud) run at the full context length. — [source](https://docs.ollama.com/capabilities/web-search#context-length-and-agents)
- <Note> Ensure OLLAMA\_API\_KEY is set or it must be passed in the Authorization header. </Note> — [source](https://docs.ollama.com/capabilities/web-search#examples)
- A new web search API is now available in Ollama. Ollama provides a generous free tier of web searches for individuals to use, and higher rate limits are available via Ollama’s cloud. — [source](https://ollama.com/blog/web-search)
- The web_search and web_fetch tools can return thousands of tokens. It is recommended to increase the context length of the model to ~32000 tokens for reasonable performance. Search agents work best with full context length. — [source](https://ollama.com/blog/web-search)
- [mcp_servers.web_search] command = "uv" args = ["run", "path/to/web-search-mcp.py"] env = { "OLLAMA_API_KEY" = "your_api_key_here" } — [source](https://ollama.com/blog/web-search)
- Web search is included with a free Ollama account, with much higher rate limits available by upgrading your Ollama subscription. — [source](https://ollama.com/blog/web-search)
- response = chat(model='qwen3', messages=messages, tools=[web_search, web_fetch], think=True) — [source](https://github.com/ollama/ollama-python/blob/main/examples/web-search.py)
- Choose a cloud model. The cloud API does not support stateful Responses, built-in web search through /v1/responses, or custom/freeform tool-call replay. — [source](https://docs.ollama.com/api/openai-compatibility)
- openapi.yaml GET /api/usage Usage statistics for cloud inference, web search, and web fetch. — [source](https://docs.ollama.com/api/cloud-usage)
- import ollama response = ollama.web_search("What is Ollama?") print(response) — [source](https://ollama.com/blog/web-search)
- For access to Ollama’s web search API, create an API key. A free Ollama account is required. — [source](https://docs.ollama.com/capabilities/web-search)
- For access to Ollama's web search API, create an [API key](https://ollama.com/settings/keys). A free Ollama account is required. — [source](https://docs.ollama.com/capabilities/web-search#authentication)
- * `query` (string, required): the search query string * `max_results` (integer, optional): maximum results to return (default 5, max 10) — [source](https://docs.ollama.com/capabilities/web-search#request)
- Web search is provided as a REST API with deeper tool integrations in Ollama’s Python and JavaScript libraries. This also enables models such as OpenAI’s gpt-oss models to conduct long-running research tasks. — [source](https://ollama.com/blog/web-search)
- result = web_fetch('https://ollama.com') print(result) — [source](https://ollama.com/blog/web-search)
- Ollama’s web search API can be used to augment models with the latest information to reduce hallucinations and improve accuracy. Web search is provided as a REST API with deeper tool integrations in the Python and JavaScript libraries. This also enables models like OpenAI’s gpt-oss models to conduct long-running research tasks. — [source](https://docs.ollama.com/capabilities/web-search)
- Ollama’s web search can be integrated with Cline easily using the MCP server configuration. Manage MCP Servers > Configure MCP Servers > Add the following configuration: — [source](https://docs.ollama.com/capabilities/web-search)
- Ollama's web search API can be used to augment models with the latest information to reduce hallucinations and improve accuracy. — [source](https://docs.ollama.com/capabilities/web-search)
- You can enable web search in any MCP client through the [Python MCP server](https://github.com/ollama/ollama-python/blob/main/examples/web-search-mcp.py). — [source](https://docs.ollama.com/capabilities/web-search#mcp-server)
- Ollama's web search can be integrated with Cline easily using the MCP server configuration. — [source](https://docs.ollama.com/capabilities/web-search#cline)
- OpenClaw ships with a bundled Ollama `web_search` provider that lets local or cloud-backed Ollama setups search the web through the configured Ollama host. — [source](https://docs.ollama.com/integrations/openclaw#web-search-and-fetch)
- * `results` (array): array of search result objects, each containing: * `title` (string): the title of the web page * `url` (string): the URL of the web page * `content` (string): relevant content snippet from the web page — [source](https://docs.ollama.com/capabilities/web-search#response)
- This web search capability can augment models with the latest information from the web to reduce hallucinations and improve accuracy. — [source](https://ollama.com/blog/web-search)
- Performs a web search for a single query and returns relevant results. — [source](https://docs.ollama.com/capabilities/web-search)

## Related concepts

- [ollama](https://llms-explorer.com/tree/ollama/) — is a related of Ollama web search and web fetch API
- api key — is a part of Ollama web search and web fetch API
- max_results — is a part of Ollama web search and web fetch API
- usage limits — is a measure of Ollama web search and web fetch API
- remote_host — is a part of Ollama web search and web fetch API
- l2-normalized — is a measure of Ollama web search and web fetch API
