OpenCode
OpenCode gets to the web through two built-in tools, and the two behave nothing alike. webfetch runs on the developer’s machine and sends a single GET from the developer’s own IP address, and in the shipping v1.19.6 it presents itself as Chrome 143 on Windows while asking for markdown or plain text ahead of HTML. websearch never touches your site at all, because it is a thin client over a third-party search MCP server (Exa or Parallel in v1, a choice of five providers plus a first-party one in v2), so ranking in OpenCode search means being in that provider’s index. In practice, you’ll see OpenCode fetches as ordinary browser traffic unless you look at the Accept header, and you won’t see OpenCode searches at all.
Before we get into the details, it’s worth knowing that the v1/v2 split matters for anyone reading logs. Everything installed with npm i -g opencode-ai today is v1.19.6 (npm latest, tag v1.19.6 at f4e363c, 2026-11-17), while a rewrite with package version 2.4.3 lives on the dev branch and changes the User-Agent, redirect handling and the search tool verified in code. OpenCode’s fetch fingerprint has changed in every generation we could find (Chrome/120 in v1.1.4, Chrome/139 in Checkly’s capture of 1.2.5, Chrome/143 in 1.19.6, a self-identifying string in v2), so any log rule you write has to be keyed to version.
At a glance
Section titled “At a glance”OpenCode v1.19.6 (npm latest) | OpenCode v2 (dev, 2.4.3) | |
|---|---|---|
| Fetch tool | webfetch | webfetch |
| Search tool | websearch, only on OpenCode Zen/Go or with an env flag | websearch, any provider, consent form on first use |
| Who issues the request | Developer machine, developer IP | Developer machine, developer IP |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; Win64; x64) ... Chrome/143.0.0.0 Safari/537.36 | Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; OpenCode-User/1.0; +https://opencode.ai |
| Accept header | Per format: markdown-first, text-first or HTML-first q-lists | Same three q-lists |
| JS rendering | None | None |
| Content conversion | turndown 7.2.0, only when content-type contains text/html | In-house streaming htmlparser2 converter |
| Size and truncation | 5 MB cap, whole body buffered | 5 MB cap, enforced while streaming |
| Timeout | 30 s default, 120 s max | 30 s default, 120 s max |
| Redirects | HTTP client default (follow) inferred | Manual, up to 10 hops, each re-checked against permissions |
| Caching | None found | None found |
| robots.txt | Not requested or honoured | Not requested or honoured |
| Permission model | Default "*": "allow", so no prompt unless configured |
Permission asserted per site, saved by site |
How fetching works
Section titled “How fetching works”OpenCode v1.19.6 builds its request in packages/opencode/src/tool/webfetch.ts. The tool takes url, an optional format of text, markdown or html that defaults to markdown, and an optional timeout in seconds verified in code. It checks only that the URL starts with http:// or https://, asks the permission system (which allows by default), and sends one GET with a hard-coded Chrome 143 Windows User-Agent, Accept-Language: en-US,en;q=0.9 and an Accept string chosen by format.
case "markdown": acceptHeader = "text/markdown;q=1.0, text/x-markdown;q=0.9, text/plain;q=0.8, text/html;q=0.7, */*;q=0.1"case "text": acceptHeader = "text/plain;q=1.0, text/markdown;q=0.9, text/html;q=0.8, */*;q=0.1"case "html": acceptHeader = "text/html;q=1.0, application/xhtml+xml;q=0.9, text/plain;q=0.8, text/markdown;q=0.7, */*;q=0.1"Excerpt from webfetch.ts at v1.19.6, lightly trimmed.
Our Dec 2026 lab run is where this gets interesting. It captured OpenCode 1.19.6 (Zen, big-pickle model) fetching a fresh canary page, and the request carried the Chrome/143 Windows UA with Accept: text/plain;q=1.0, text/markdown;q=0.9, text/html;q=0.8, */*;q=0.1 from the developer’s IP measured in our lab (lab run). That’s the text branch, not the markdown default. The schema default in the v1.19.6 source is markdown, so the likely explanation is that the model passed format: "text" explicitly because the prompt asked for an exact phrase inferred. So in practice the Accept header OpenCode sends depends on what the model picks on each call: markdown-first when the model leaves the default or asks for markdown, text-first or HTML-first otherwise. Checkly independently captured OpenCode 1.2.5 sending the markdown-first string with a Chrome/139 UA (Checkly) documented.
The Chrome UA is a deliberate disguise, and the code doesn’t hide it. When the first request comes back 403 with the response header cf-mitigated: challenge, OpenCode v1 retries once with User-Agent: opencode, and the source comment reads “Retry with honest UA if blocked by Cloudflare bot detection (TLS fingerprint mismatch)” verified in code. Netlify’s own agent classifier labelled our OpenCode request browser, which tells me the spoof works against at least one platform-level detector measured in our lab.
OpenCode v1.19.6 webfetch, including the Cloudflare fallback
- Model→OpenCode CLI
webfetch(url, format)format defaults to markdown
- OpenCode CLI
permission check (allow) - OpenCode CLI→Your site
GET urlUA Chrome/143 Win, Accept by format
- Your site→OpenCode CLI
403 cf-mitigated: challengeonly on Cloudflare challenge
- OpenCode CLI→Your site
GET url againUA: opencode
- Your site→OpenCode CLI
200 text/html or text/markdown - OpenCode CLI
turndown if text/html - OpenCode CLI→Model
markdown, text or html
Conversion in v1 uses turndown 7.2.0 with ATX headings and fenced code, and removes only script, style, meta and link elements, so your navigation, footers and cookie banners all land in the model’s context verified in code. The text format uses htmlparser2 and also skips noscript, iframe, object and embed. Conversion runs only when the response content-type contains text/html, so an origin that answers with text/markdown has its markdown passed through untouched. Images come back as base64 attachments, and any other type is decoded as UTF-8 text. There’s no cache, no robots.txt request and no retry beyond the Cloudflare one.
The v1 tool description, in webfetch.txt, tells the model to step aside whenever something better is installed. If you ship an MCP server, that sentence matters to you, since an OpenCode user with a docs or fetch MCP configured is being nudged toward it.
- IMPORTANT: if another tool is present that offers better web fetching capabilities, is more targeted to the task, or has fewer restrictions, prefer using that tool instead of this one.- HTTP URLs will be automatically upgraded to HTTPS- Format options: "markdown" (default), "text", or "html"By the way, the “automatically upgraded to HTTPS” line has no matching code in v1.19.6, so it’s a description-only claim verified in code.
What v2 changes in webfetch
Section titled “What v2 changes in webfetch”OpenCode v2 moves the tool to packages/core/src/tool/plugin/webfetch.ts and it’s the first generation that identifies itself, with the UA Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; OpenCode-User/1.0; +https://opencode.ai verified in code. The three Accept strings, the Accept-Language value and the Cloudflare fallback to User-Agent: opencode don’t change. Redirects are handled manually with redirect: "manual", up to ten hops, fragment stripped, and every hop re-checked against the user’s permission rules. URLs with embedded credentials are rejected, and images and other non-text MIME types now fail with an error instead of becoming attachments.
The v2 HTML converter is an in-house streaming htmlparser2 implementation in tool/html-markdown.ts that omits script, style, noscript, iframe, object, embed, meta, link and template while keeping tables, code blocks and links. The tool description shrinks to “Fetch content from an HTTP or HTTPS URL and return it as text, markdown, or HTML. Markdown is the default. Use a more targeted tool when one is available”, so the instruction to prefer other tools survives, just in shorter form.
How searching works
Section titled “How searching works”The first thing to understand is that OpenCode websearch isn’t a search engine. In v1.19.6 (websearch.ts, mcp-websearch.ts) it posts a JSON-RPC tools/call to one of two remote MCP servers with a 25 s timeout verified in code. The Exa call is web_search_exa with numResults: 8, type: "auto" and livecrawl: "fallback" against https://mcp.exa.ai/mcp. The Parallel call is web_search against https://search.parallel.ai/mcp and passes the session ID and the model’s API ID along with the query, which lets Parallel correlate searches by session and by model (worth knowing if you care about what leaves the developer’s machine).
Provider choice in v1 is deterministic, and the user mostly never sees it. OPENCODE_WEBSEARCH_PROVIDER wins if set, then OPENCODE_ENABLE_PARALLEL, then OPENCODE_ENABLE_EXA, and otherwise checksum(sessionID) % 2 splits sessions 50/50 between Exa and Parallel verified in code. The tool is only offered at all when the provider is OpenCode Zen or OpenCode Go, or one of those env flags is set, which the tools docs confirm documented. That means a developer using their own Anthropic or OpenAI key with no flag has webfetch and no search tool at all.
When we ran it on Zen in the lab, the tool label read “Exa Web Search”, the results came from Exa’s index, and our new canary site wasn’t there, so no request reached our origin measured in our lab.
- OpenCode CLI → Model provider
tool call chosen - OpenCode CLI → Exa / Parallel MCP
websearch query - Exa / Parallel MCP → docs.example.com
own crawl, own UA - OpenCode CLI → docs.example.com
webfetch GET, dev IP
The search description injects the current year, and v1 says so forcefully. The text is quoted from websearch.txt, with {{year}} filled from new Date().getFullYear():
The current year is {{year}}. You MUST use this year when searching forrecent information or current events - Example: If the current year is2026 and the user asks for "latest AI news", search for "AI news 2026",NOT "AI news 2025"The query string is passed through verbatim, so the only rewriting is whatever the model writes. I’d expect OpenCode-driven queries to skew toward containing the current year, which favours pages whose titles carry it inferred.
What v2 changes in websearch
Section titled “What v2 changes in websearch”OpenCode v2 turns search providers into plugins under packages/core/src/plugin/websearch/: Exa, Firecrawl MCP, Parallel MCP, Tavily REST, TinyFish MCP, and a first-party “opencode” provider that posts to <server>/api/websearch verified in code. The Zen-only gate is gone, and instead the first search triggers a form asking “Allow OpenCode to search the web for up-to-date information?” with options to allow, choose another provider or disable, and the answer is stored. A “random” mode spreads queries across providers and fails over on 429, 402 or quota errors with a 15-minute cooldown.
The v2 tool input is only {query}, the year hint is softened from “MUST” to “Use this year”, and results are rendered to the model as a title link, a Published: date and content per hit. Because the model now sees published dates, on-page and indexed dates become a visible freshness signal in v2 inferred. Non-Exa providers receive User-Agent: opencode/<channel>/<version>/<name> from OpenCode, which only the provider sees.
Other paths to your content
Section titled “Other paths to your content”OpenCode loads arbitrary MCP servers, and their tools skip webfetch and websearch entirely documented. Because the v1 fetch description tells the model to prefer a more capable or more targeted tool, a configured docs MCP or Firecrawl-style fetch server is likely to win the call inferred. OpenCode also has a shell tool, so a model can run curl or a script and produce a curl/x.y or language-runtime UA; see the Pi page for what that looks like in practice. The explore subagent explicitly allows both web tools. There was also an older codesearch tool (Exa get_code_context_exa) in v1.1.4, and it’s gone from both v1.19.6 and dev.
What shows up in your logs
Section titled “What shows up in your logs”| Action | Source IP | User-Agent | Other headers | robots.txt |
|---|---|---|---|---|
v1 webfetch, markdown format |
Developer | Chrome/143.0.0.0 on Windows NT 10.0 | Accept: text/markdown;q=1.0, text/x-markdown;q=0.9, ..., Accept-Language: en-US,en;q=0.9, no Sec-Fetch-*, no Referer |
Not fetched |
v1 webfetch, text format (seen in our lab) |
Developer | Chrome/143.0.0.0 on Windows NT 10.0 | Accept: text/plain;q=1.0, text/markdown;q=0.9, text/html;q=0.8, */*;q=0.1 |
Not fetched |
| v1 or v2 after a Cloudflare challenge | Developer | opencode |
Same Accept, milliseconds after the first request | Not fetched |
v2 webfetch |
Developer | contains OpenCode-User/1.0; +https://opencode.ai |
Same Accept strings; one request per redirect hop | Not fetched |
websearch |
None | None | Your site is only hit by the provider’s own crawler | Provider’s policy |
If I had to pick one reliable v1 fingerprint, it’s the combination of a Chrome UA, a q-weighted Accept list that lists text/markdown or text/plain at all, and the absence of the Sec-Fetch-* headers a real Chrome would send inferred. There’s no stable IP range, since every request leaves from the developer’s own network, so add OpenCode’s strings to your user-agent reference by version.
What this means for discoverability
Section titled “What this means for discoverability”OpenCode is one of the few agents that asks for markdown first by default, which means serving text/markdown on content negotiation pays off directly: the response skips turndown, and nav and footer noise never reach the model. If you rely on Cloudflare’s or Vercel’s markdown-for-agents features, test them with OpenCode’s exact Accept string, because a negotiation rule keyed on UA will miss a Chrome-spoofing client. And if your bot management challenges unknown browsers, expect the opencode retry and decide whether you want to let it through.
Being found through OpenCode search means being in Exa’s index (and Parallel’s, for half of v1 sessions on defaults), not Google’s or Bing’s. That’s exactly why our canary page was invisible to OpenCode search. Check those indexes directly as part of the test catalog, and see the comparison matrix for how this differs from Claude Code and Codex.
Tests to run against this agent
Section titled “Tests to run against this agent”- Default fetch headers. Point OpenCode v1.19.6 at a logging endpoint and prompt
Fetch <url> and summarise itwithout mentioning exact text. Expected: Chrome/143 UA and the markdown-first Accept string. Repeat with “return the exact phrase” to see whether the model switches toformat: "text"as in our lab run. - Markdown negotiation. Serve
text/markdownwhen Accept prefers it and HTML otherwise, with different marker phrases in each. Expected: OpenCode quotes the markdown marker in markdown and text modes. - Cloudflare fallback. Put the endpoint behind a managed challenge. Expected: a first request with the Chrome UA, then a second with
User-Agent: opencode. - v2 identity. Build from
devand repeat test 1. Expected:OpenCode-User/1.0in the UA and one log line per redirect hop. - Search index presence. On Zen, ask OpenCode to search for a unique phrase from your site. Expected: a hit only if Exa (or Parallel) has indexed the page; no request to your origin unless the model follows up with
webfetch. - Year bias. Ask an undated “best X” question and capture the query in the tool call. Expected: the current year appears in the query.
Open questions
Section titled “Open questions”- v1 redirect behaviour is inferred from the Effect HTTP client default rather than asserted in code, and a 301 to another host on the test endpoint would settle it.
- Exa’s
livecrawl: "fallback"can trigger Exa’s own fetcher, whose UA we have not captured. - We don’t know when v2 will reach npm
latest;npm view opencode-ai dist-tagsis the thing to watch. - We haven’t measured how often models pick
textover the markdown default, and a batch of fetch prompts across several models would give us a rate.
Further reading
Section titled “Further reading”- OpenCode tools documentation and permissions documentation
- The Current State of Content Negotiation for AI Agents (Checkly)
- HTTP Behavioral Signatures of AI Coding Agents in Documentation Portals (arXiv 2604.02544)
- Markdown for Agents (Cloudflare)
- Make your documentation readable by AI agents (Vercel)
Last reviewed 2026-12-02 against OpenCode 1.19.6 and dev at 6eae2e79 (2.4.3). This site is re-reviewed monthly; see maintenance.