Kansoku
English日本語简体中文免费开始

本页由英文原文翻译,尚未经母语者校对。以英文版为准。 阅读英文原文

快速开始

创建密钥、抽取一个页面、读懂结果。最后一步会告诉你怎么核对刚拿到的数字。目前为早期访问阶段。

早期访问阶段。 API 目前逐个开放给主动联系我们的人,公开注册尚未开放。 本页的命令要在我们发放密钥之后才能运行 —— 现在执行不会通过。 如实写明,是为了不让失败看起来像你这边配置错了。有兴趣请与我们联系。

1. 获取密钥

在控制台创建。只显示一次,保存的只有哈希值。 丢失时请重新签发,而不是要求我们找回 —— 我们找不回。

测试密钥以 wi_test_ 开头,正式密钥以 wi_live_ 开头。测试模式的用量 会计量但不会计费,因此可以在产生任何费用之前把接入完整跑一遍。

2. 抽取一个页面

先把密钥放进环境变量。不执行这一行,下面的 curl 会发送 Bearer (空密钥),返回 401 —— 看起来像是你输入错了,其实原因就是这一行。

export WI_API_KEY="wi_test_在控制台创建的密钥"
curl -X POST https://api.kansoku.ai/v1/extract \
  -H "Authorization: Bearer $WI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/category/cameras",
    "country": "JP",
    "levels": ["css", "structured_data"],
    "schema": {
      "listings": {
        "type": "list",
        "item": { "name": "string", "price": "number", "currency": "string" }
      }
    }
  }'

levels 是从便宜到贵的阶梯。去掉 llm,就是这次请求不产生任何模型 token 费用的保证 —— 绝大多数商品页根本不需要它。

3. 读取记录

{
  "data": { "listings": [ { "name": "…", "price": 1444300, "currency": "JPY" } ] },
  "metadata": {
    "country": "JP",
    "retrieved_at": "2026-08-21T02:20:04.756Z",
    "request_id": "req_…",
    "level": "structured_data",
    "attempts": [
      { "level": "css", "matched_fields": 0, "duration_ms": 5, "error": null },
      { "level": "structured_data", "matched_fields": 1, "duration_ms": 12, "error": null }
    ],
    "http_status": 200,
    "duration_ms": 1436
  }
}

attempts 恰恰在调用成功时最值得读。 原本 css 就能拿到的页面,现在要落到 structured_data 才行,说明对方改版了。而两者都匹配不上的那一天, 你的数字不是变错,而是变哑。

最后更新