Home / Developer API

Developer API — public endpoints and MCP

Every record in the directory is machine-readable: read-only JSON endpoints are open cross-origin, corrections go through a protected write endpoint, and AI clients can attach the directory as MCP.

1. Public read-only API

No auth, Access-Control-Allow-Origin: *, cached for 5 minutes. Prices are per 1M tokens.

PathContents
/api/v1/all.jsonFull snapshot (vendors, models, suppliers, prices, changes)
/api/v1/models.jsonModels with official prices and specs
/api/v1/vendors.jsonVendor directory
/api/v1/offers.jsonToken supplier directory
/api/v1/prices.jsonPer-model, per-supplier price rows
/api/v1/changes.jsonPrice and supply changelog
/llms.txtSite index for LLMs

curl -s https://kunlab.cn/api/v1/prices.json | head -c 400

2. Correction write endpoint

The write endpoint is separate from the read API: submissions land in a review queue and only change published data after verification.

POST https://kunlab.cn/api/v1/corrections/public — public submissions, rate limited to 5 per IP per hour
POST https://kunlab.cn/api/v1/corrections — partner endpoint, requires an X-KunLab-Key header

curl -X POST https://kunlab.cn/api/v1/corrections/public \
  -H 'Content-Type: application/json' \
  -d '{"model":"claude-fable-5-2","offer":"ohmygpt","price_in":7.04,
       "price_out":35.2,"currency":"USD","source_url":"https://example.com/pricing",
       "note":"页面显示的输入价","contact":"you@example.com"}'

3. MCP server

The same SQLite source, exposed as MCP tools to AI clients (Claude Desktop / Cursor / your own agent).

{
  "mcpServers": {
    "kunlab-directory": {
      "command": "/srv/kunlab-directory/.venv/bin/python",
      "args": ["/srv/kunlab-directory/scripts/mcp_server.py"]
    }
  }
}

Tools: search_models · get_model · get_price · list_vendors · list_offers · price_index

4. How the data stays fresh