AI Studio API
鉴权与账户
创建 API Key、完成请求鉴权并读取账户信息。
API Playground
直接向当前站点发送真实请求,并立即查看 HTTP 响应。
响应结果
发送请求后,响应内容会显示在这里。必需请求头
登录后创建 API Key,并在每次接口请求中携带。
Authorization: Bearer YOUR_API_KEY示例域名会自动读取 NEXT_PUBLIC_SITE_URL。你只需要把 YOUR_API_KEY 替换为账号中生成的 API Key。
GET
/api/auth/user读取账号信息、剩余积分和会员状态。
请求头
Authorization: Bearer YOUR_API_KEY请求参数
无请求参数。
请求示例
curl -X GET "https://freesoragenerator.com/api/auth/user" \
-H "Authorization: Bearer YOUR_API_KEY"响应示例
{
"success": true,
"data": {
"user": {
"id": "user-id",
"email": "developer@example.com",
"role": "user",
"name": "Developer",
"image": null,
"authType": "apikey"
},
"credits": 120,
"membership": {
"isVip": false,
"level": "none",
"planTitle": null
}
}
}错误示例
{
"success": false,
"error": "User not authenticated"
}