Kansoku
English日本語简体中文

クイックスタート

キーを作り、1ページ取得し、結果を読むまで。最後に、受け取った数字の確かめ方も示します。現在は早期アクセスです。

早期アクセス中です。 APIは現在、お問い合わせいただいた方へ個別にご案内しています。一般公開の申し込みはまだ開いていません。このページのコマンドは、キーをお渡ししてから動くものです ―― 今すぐ実行しても通りません。そう書いておかないと、動かないことをご自分の設定のせいだと思わせてしまうので。ご希望の方はこちらからご連絡ください。

1. キーを取得する

管理画面で作成します。表示は1度だけで、保存されるのはハッシュのみです。紛失した場合は復元を依頼するのではなく再発行してください ―― 復元はできません。

テストキーは wi_test_、本番キーは wi_live_ で始まります。テストモードの利用は計測されますが請求されません。費用が発生する前に、統合をひととおり試せます。

2. ページを取得する

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 を外すことが、そのリクエストでモデルのトークン費用が一切かからないことの保証になります。商品ページのほとんどは llm を必要としません。

3. SDKを使う場合

import { WebIntelligence } from "@wi/sdk";

const wi = new WebIntelligence({ apiKey: process.env.WI_API_KEY! });

const { data, metadata } = await wi.extract.run({
  url: "https://example.com/category/cameras",
  country: "JP",
  levels: ["css", "structured_data"],
  schema: {
    listings: {
      type: "list",
      item: { name: "string", price: "number", currency: "string" },
    },
  } as const,
});

as const は必須です。これがあるから data.listings がレコードの配列として型付けされます。無いと unknown になります。

4. 記録を読む

{
  "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 まで落ちるようになったなら、相手がページを作り直したということです。そして両方に当たらなくなった日が、数字が間違うのではなく黙る日 です。

最終更新