LitSource Agent 平台

REST API v1

使用带权限范围的 Agent Token 搜索证据、验证引文、获取运行记录和查询额度用量。

POST/api/v1/evidence/search

仅在有结果返回时消耗 1 credit。

POST/api/v1/references/verify

沿用现有 Verify 计费公式:每 10 条引文 3 credits。

GET/api/v1/runs/{id}

免费。仅返回该 Token 所属用户的运行记录。

GET/api/v1/usage

免费。返回当前余额和 UTC 自然日的 Token 用量。

认证与重试

发送 Authorization: Bearer lsa_…。付费 POST 端点还需要 8–128 字符的 Idempotency-Key。超时后可用相同的 key 和相同的请求体重试;如果 key 相同但请求体不同,返回 HTTP 409。

每个响应都包含 billing.credits_charged。错误、服务方故障和零结果搜索不消耗 credits。

Try the API

Your token stays in this browser tab and is sent only to this LitSource origin.

代码示例

curl

curl https://litsource.net/api/v1/evidence/search \
  -H "Authorization: Bearer $LITSOURCE_AGENT_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: search-$(date +%s)" \
  -d '{"query":"Aspirin reduces cardiovascular events","max_hits":5}'

JavaScript

const response = await fetch("https://litsource.net/api/v1/evidence/search", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.LITSOURCE_AGENT_TOKEN}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({ query: "Aspirin reduces cardiovascular events", max_hits: 5 }),
});
console.log(await response.json());

Python

import os, uuid, requests

response = requests.post(
    "https://litsource.net/api/v1/references/verify",
    headers={
        "Authorization": f"Bearer {os.environ['LITSOURCE_AGENT_TOKEN']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={"references": ["Smith J. Example study. Nature. 2024."]},
)
print(response.json())

错误码

常见错误码:INVALID_TOKEN(401)、INSUFFICIENT_CREDITS(402)、SCOPE_DENIED(403)、IDEMPOTENCY_KEY_CONFLICT(409)、CREDIT_CHECK_FAILED(503)。所有错误响应都包含 billing.credits_charged: 0

Use cases

  • Verify citations inside your coding agent. Paste a draft reference list and ask Cursor or Codex to run litsource_verify_references — it flags fabricated or mismatched citations before they reach your paper.
  • Fact-check a claim while writing. Ask Claude to call litsource_search_evidence on a sentence like "aspirin reduces cardiovascular events" and get real PubMed / Crossref evidence supporting or challenging it.
  • Build a citation-checking workflow. Use the REST API to verify references in bulk, read results back with GET /api/v1/runs/{id}, and monitor spend with GET /api/v1/usage.

Credits & pricing

Every Agent API and MCP call is metered in LitSource credits. You are only charged when a call produces a usable result — failures and zero-result searches cost nothing.

OperationCreditsWhen charged
Search evidence1 creditOnly when ≥1 result is returned
Verify references3 per 10 referencesPer completed verification (max 100 refs)
Get runFree
Get usageFree

Free accounts can verify up to 10 references per call; verifying more requires Pro or Trial. Retrying the same request with the same idempotency key returns the cached result without charging again.

Response format

Every successful call returns a uniform envelope with data, billing, and meta:

{
  "data": {
    "results": [
      { "title": "…", "doi": "10.…", "pmid": "…", "relevance": 0.94 }
    ]
  },
  "billing": {
    "credits_charged": 1,
    "balance_after": 99,
    "reused": false
  },
  "meta": {
    "request_id": "my-search-001",
    "quality_version": null
  }
}

Failures never charge credits — billing.credits_charged is always 0:

{
  "error": {
    "code": "INSUFFICIENT_CREDITS",
    "message": "Insufficient LitSource credits",
    "details": { "remaining_credits": 2, "required_credits": 3 }
  },
  "billing": { "credits_charged": 0 }
}

Limits & quotas

  • Max 100 references per verification.
  • Free plan: 10 references per verification call.
  • Idempotency key: 8–128 characters, [A-Za-z0-9._:-].
  • No daily credit limit and no rate limit — your credit balance is the only cap. Calls fail with INSUFFICIENT_CREDITS once depleted.
LitSource — AI引文验证 & 生物医学文献检索工具