API 参考

鉴权指南

如何对你的 API 请求进行身份验证

要使用我们的 API,你需要对请求进行身份验证。我们提供了一种简单易用的 API Key 机制。

获取 API Key

  1. 登录你的账号。
  2. 进入控制台的 API Keys 页面。
  3. 点击 创建新密钥 (Create New Key)。
  4. 请妥善保管此密钥,切勿公开发布。

使用 API Key

你可以将 API Key 作为 Bearer Token 放在 HTTP 请求头的 Authorization 字段中传递。

请求示例

curl -X POST "https://qxan.net/api/ai/images/generations" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "一座未来城市",
    "model": "runninghub-t2i-v1"
  }'

错误代码

如果鉴权失败,你将收到 401 Unauthorized 的响应:

{
  "error": {
    "message": "Unauthorized. Valid authentication is required to use this API.",
    "type": "unauthorized_error",
    "param": null,
    "code": 401
  }
}