GitHub PR:web_fetch 增加 `Accept: text/markdown` 以降低抓取 token 成本
通过优先请求 markdown 响应并直返文本,减少 HTML 解析路径的 token 消耗,适合高频网页研究任务。
GITHUBDiscovered 2026-02-13Author echoVic
Prerequisites
- OpenClaw runtime supports updated `web_fetch` header behavior (PR merged build).
- Target site may provide `Content-Type: text/markdown` (e.g., Cloudflare Markdown for Agents).
Steps
- Call `web_fetch` against markdown-capable site and inspect response content-type.
- When response is markdown, bypass HTML extraction and return markdown directly.
- Benchmark token usage before/after header update on identical URLs.
- Keep compatibility fallback: if site ignores Accept preference, continue normal HTML extraction.
Commands
openclaw gateway statusnpm run buildopenclaw helpVerify
Markdown-capable sites return direct markdown with reduced token footprint; non-markdown sites remain behavior-compatible.
Caveats
- Token reduction ratio varies by site template and markdown quality; quoted 80% is scenario-dependent(需验证).
- Some markdown responses may omit embedded data present in raw HTML (scripts/meta blocks).
Source attribution
This tip is aggregated from community/public sources and preserved with attribution.
Open original source ↗