POST
/distill
蒸馏单个页面

将网页转换为干净的、LLM 就绪的 Markdown 格式。

使用场景:

  • 为 RAG(检索增强生成)准备网页内容
  • 提取文章内容用于 AI 处理
  • 将文档页面转换为 Markdown
  • 处理动态网页应用

包含内容:

  • 保留结构的干净 Markdown 内容
  • 自动移除广告、导航和样板内容
  • 元数据提取(标题、描述、语言)
  • JavaScript 渲染处理动态内容
  • 自动处理反爬虫措施

输出格式: 返回针对 LLM 消费优化的 Markdown,最小噪音,最大信号。

授权

YOUR_API_KEY
授权Bearer <token>

在 Thunderbit Dashboard 获取 API key。请求头格式:Authorization: Bearer YOUR_API_KEY

位置: header

请求体

application/json

TypeScript Definitions

Use the request body type in TypeScript.

url*string必填

要蒸馏的网页 URL

示例:https://thunderbit.com/playground
timeoutnumber默认值:30000

请求超时时间(毫秒),默认 30000,最大 60000

取值范围:5000 <= x <= 60000
示例:
30000
waitFornumber默认值:0

页面加载后等待动态内容渲染的时间(毫秒),然后再提取内容

取值范围:0 <= x <= 10000
示例:
2000
includeTagsstring[]

仅包含这些 HTML 标签中的内容(如 ['article', 'main', 'div.content'])

示例:
[
  "article",
  "main"
]
excludeTagsstring[]

排除这些 HTML 标签中的内容(如 ['nav', 'footer', 'aside'])

示例:
[
  "nav",
  "footer",
  "aside"
]
headersobject

随请求发送的自定义 HTTP 头

示例:
{
  "Accept-Language": "en-US"
}
countryCodestring默认值:"US"

用于地理定位的 2 字母 ISO 国家码(默认 US)。流量将通过指定国家的代理服务器转发。

示例:US
renderModestring默认值:"none"

JavaScript 渲染模式。none = 不渲染 JS(最快,默认);basic = 标准渲染;full = 标准渲染并延长等待以处理动态内容

取值范围"none" | "basic" | "full"
forceRefreshboolean默认值:false

绕过缓存,强制重新抓取页面(默认 false)

formatsany[]

输出格式。字符串用于选择简单格式;对象用于参数化 LLM 格式(summaryquestionhighlights)。

示例:
[
  "markdown",
  "links",
  "images"
]
includestring[]

响应中可选包含的字段。可选值:metadata(标题、描述、语言等)、html(原始 HTML)、links(提取的链接)。可替代 includeHtmlextractLinks

示例:
[
  "metadata",
  "links"
]
includeHtmlboolean默认值:false

响应中是否包含原始 HTML(默认 false)。建议改用 include 参数。

extractLinksboolean默认值:false

是否从页面提取链接(默认 false)。建议改用 include 参数。

响应

application/json

成功响应

successboolean
示例:
true
dataobject
展开子属性
urlstring

被蒸馏的 URL

示例:https://thunderbit.com/playground
markdownstring

从页面提取的干净 Markdown 内容

示例:# Understanding Web Distillation Web distillation is the process of converting raw HTML into clean, structured content... ## Key Benefits - **LLM-Ready Format**: Optimized for AI consumption - **Noise Removal**: Automatic filtering of ads and boilerplate - **Structure Preservation**: Maintains semantic hierarchy
metadataobject

Page metadata (only returned when include contains metadata)

展开子属性
titlestring

标签或 Open Graph 提取的页面标题

示例:Understanding Web Distillation | Tech Blog
descriptionstring

Meta 描述或摘要

languagestring

检测到的语言代码(ISO 639-1)

示例:en
sourceUrlstring

Original URL (may differ from requested URL due to redirects)

statusCodeinteger

响应的 HTTP 状态码

示例:
200
htmlstring

原始 HTML 内容(可选,仅在请求时返回)

示例:
null
linksobject[]

内容中发现的链接

展开子属性
textstring

Visible link text as rendered in the page

示例:Read more
hrefstring

Resolved absolute URL of the link

示例:https://example.com/article
imagesobject[]

从页面提取的图像。

展开子属性
srcstring

Image source URL.

示例:https://example.com/hero.png
altstring

Image alt text.

示例:Hero banner
widthinteger

Image width in pixels.

heightinteger

Image height in pixels.

summarystring

结构化 Markdown 摘要(LLM 格式)。

answerstring

question 格式中提供的问题的回答。

highlightsstring[]

highlights 格式呈现的高亮段落。

errorobject
示例:
null