开发者指南

快速开始

只需修改一行:把 baseURL 指向 Axonera。无需改其他代码。

curl https://api.axonera.ai/v1/chat/completions \
  -H "Authorization: Bearer $AXONERA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "messages": [{"role":"user","content":"Hello!"}]
  }'

认证

所有请求需要在 Authorization 头部携带 Bearer token。在密钥页面 mint 密钥。

Authorization: Bearer sk-axn-<your-key>
read
write
admin
audit-replay

Chat completions

主文本端点。支持流式、工具调用、视觉、JSON 模式与提示缓存。

POST/v1/chat/completions

参数

modelstring"auto" 或指定模型 slug。auto 使用智能路由。
messagesarray消息数组,每条包含 role 和 content。
streamboolean开启 SSE 流式输出。
temperaturenumber0–2,默认 1。
toolsarray工具调用的函数定义列表。
fallback_chainarrayAxonera 扩展:按序指定 fallback 模型列表。

错误码

所有错误返回统一信封。type 字段跨版本稳定,code 更细粒度。

{
  "error": {
    "type": "rate_limit_error",
    "code": 429,
    "message": "Too many requests — retry after 1 s",
    "retry_after_ms": 1000,
    "request_id": "req_01234abc"
  }
}
400Bad Request — 参数无效
401Unauthorized — API Key 无效或缺失
403Forbidden — 权限不足
429Rate Limited — 请求过快,降速后重试
500Server Error — Axonera 内部错误
503Service Unavailable — 所有上游均不可用

速率限制

请求/秒(per key)

40 req/s

请求/分钟(per org)

6,000 req/min

Tokens/分钟

600k TPM

并发流式连接

20

图片任务/分钟

60

单请求最大体积

10 MB

收到 429 时检查 Retry-After 头部获取退避时间。

Documentation | Axonera