跳转到主要内容
GET
/
v1
/
models
获取可用模型列表
curl --request GET \
  --url https://api.example.com/v1/models \
  --header 'Authorization: <authorization>'
{
  "object": "<string>",
  "data": [
    {
      "owned_by": "<string>",
      "id": "<string>",
      "object": "<string>",
      "created": 123
    }
  ]
}
此接口兼容 OpenAI 模型列表协议,用于获取当前可用的模型列表。

功能特性

  • 返回 OpenAI 兼容格式的模型列表
  • 复用 Caffeine 本地缓存,响应速度快

认证方式

在请求头中携带 Authorization 字段,格式为 Bearer YOUR_API_KEY

快速示例

import requests

url = "https://api.haitoken.ai/v1/models"
headers = {
    "Authorization": "Bearer YOUR_API_KEY"
}

response = requests.get(url, headers=headers)
print(response.json())

响应示例

{
  "object": "list",
  "data": [
    {
      "id": "gpt-4o",
      "object": "model",
      "owned_by": "openai",
      "created": 1715367049
    }
  ]
}
此接口兼容 OpenAI 模型列表协议,用于获取当前可用的模型列表。

功能特性

  • 返回 OpenAI 兼容格式的模型列表

响应示例

{
  "object": "list",
  "data": [
    {
      "id": "gpt-4o",
      "object": "model",
      "owned_by": "haitoken",
      "created": 1715367049
    }
  ]
}

请求头

Authorization
string
必填
示例:

"Bearer YOUR_API_KEY"

Content-Type
string
示例:

"application/json"

响应

200 - application/json

OpenAI 兼容的模型列表响应 参考:https://platform.openai.com/docs/api-reference/models/list

object
string

对象类型,固定为 "list"

data
object[]

模型列表