Appearance
认证鉴权
鉴权方式
http
Authorization: Bearer YOUR_API_KEYInfiFlow API 使用 API Key 进行认证。您可以在后台的"API密钥"页面创建和管理您的 API Key。
注意
请始终在服务端调用 API,切勿泄露您的 API Key。
认证鉴权示例
bash
curl https://llm.infiflow.cn/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY"powershell
$headers = @{
"Content-Type" = "application/json"
"Authorization" = "Bearer YOUR_API_KEY"
}python
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
}java
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://llm.infiflow.cn/v1/chat/completions"))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer YOUR_API_KEY")
.build();vue
const headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
}javascript
const headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
}csharp
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");vb
Dim client As New HttpClient()
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY")java
request.Headers.Add("Authorization", "Bearer YOUR_API_KEY");返回响应示例
✅ 200 成功
请求成功,返回数据如下:
json
{
"status": 200,
"message": "Success"
}❌ 401 Unauthorized
请求API密钥错误或未授权,返回数据如下:
json
{
"error": {
"code": "",
"message": "Invalid token (request id: 202606291xxxxxxxx)",
"type": "new_api_error"
}
}