The REST API is the lowest-friction surface: HTTPS, Bearer auth, JSON in, JSON out. The CLI calls this endpoint under the hood, and the MCP route tool delegates to the same engine.

Endpoint

POST https://api.agentsframe.com/v1/think
Authorization: Bearer <api-key>
Content-Type: application/json

Request body

FieldTypeRequiredDefaultDescription
intentstringNatural-language description of what you’re trying to do.
lang'en' | 'zh'autoOverride automatic language detection.
topKnumber3Number of candidates to return (1–10).
recallKnumber16pgvector recall pool size before rerank (8–64).
categorystringRestrict to a category slug (reserved; not yet enforced).
excludeSlugsstring[][]Slugs to exclude from results.

Example

curl -sS https://api.agentsframe.com/v1/think \
  -H "Authorization: Bearer $AGENTS_FRAME_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "intent": "我们要不要重写这个老旧模块",
    "topK": 3
  }'

Response

{
  "selected": {
    "slug": "second-order-thinking",
    "frameworkVersionId": "fv_01H...",
    "promptMd": "# Second-order thinking\n\n..."
  },
  "candidates": [
    { "slug": "second-order-thinking", "score": 0.91 },
    { "slug": "inversion",             "score": 0.78 },
    { "slug": "first-principles",      "score": 0.64 }
  ],
  "detectedLang": "zh",
  "latencyMs": 412
}

Errors

StatusCodeMeaning
400bad_requestMissing intent or invalid params.
401unauthorizedMissing or invalid Authorization header.
429quota_exceededTier quota hit. Response includes upgrade_url.
500internal_errorRouting engine error; safe to retry once with backoff.

Rate limits

Quotas are tier-aware and enforced per API key:
TierLimit
Free5 calls / day
Starter1,500 calls / month
Pro3,500 calls / month
A 429 response includes a JSON body with upgrade_url so your agent can prompt the user to upgrade in-flow.