开发者 API
面向开发者的标准化调用入口。目标是在 5 分钟内完成首次服务调用,并获得可追踪、可审计、可计量的运行结果。
首次调用
curl -X POST https://aitobot.cn/api/v1/agent-runs \
-H 'authorization: Bearer <api-key>' \
-H 'content-type: application/json' \
-H 'idempotency-key: schedule-check-001' \
--data '{"agent_id":"student-schedule-planner","input":"检查默认课表"}'
接入门禁
- Bearer API Key 认证,服务端只保存摘要。
- 分钟级限流与每日调用额度。
- 幂等键避免重试造成重复调用。
- 每次调用返回请求编号,便于排障和审计。
注册 Key:1 个。新 token 只在创建时返回一次;生产部署前关闭启动管理 Key。
默认账号:portal-owner · Developer · 100 次/日。
API 面
GET /api/v1/agents
GET /api/v1/account
GET /api/v1/accounts
POST /api/v1/accounts
GET /api/v1/api-keys
POST /api/v1/api-keys
POST /api/v1/api-keys/{key_id}/revoke
POST /api/v1/agent-runs
GET /api/v1/agent-runs/{run_id}
POST /api/v1/agent-runs/{run_id}/cancel
GET /api/v1/usage
GET /api/v1/wiki/search?q=agent
创建开发者 Key
curl -X POST http://127.0.0.1:18880/api/v1/api-keys \
-H 'authorization: Bearer <management-api-key>' \
-H 'content-type: application/json' \
--data '{"name":"local developer","scopes":["agent-runs:read","agent-runs:write","wiki:read","usage:read"]}'
服务端只保存 hash;撤销后立即不可用于后续调用。