列出模型
GET/v1/models
列出当前 API Key 可调用的模型。API Key 设置了模型限制时,只返回允许的模型。参数规则请以本参考中各接口页面为准。
请求头
Authorizationstring必填Bearer <API_KEY>。
返回值
HTTP 200。
objectstring可选固定为
list。successboolean可选固定为
true。dataobject[]可选模型列表。
显示子字段(5)
idstring可选模型 ID,即请求中的
model。objectstring可选固定为
model。createdinteger可选Unix 秒。
owned_bystring可选归属标识,仅供展示。
supported_endpoint_typesstring[]可选可用接口类型。
支持的取值
openai-video视频模型,使用/v1/videosimage-generation图片模型,使用/v1/images/*
错误
| HTTP | code | 原因与处理 |
|---|---|---|
| 401 | — | API Key 无效、过期或已禁用。 |
curl https://ling-light.com/v1/models \
-H "Authorization: Bearer $LINGLIGHT_API_KEY"const response = await fetch('https://ling-light.com/v1/models', {
headers: {
Authorization: `Bearer ${process.env.LINGLIGHT_API_KEY}`,
},
})
console.log(response.status, await response.json())import os
import requests
response = requests.get(
"https://ling-light.com/v1/models",
headers={
"Authorization": f"Bearer {os.environ['LINGLIGHT_API_KEY']}",
},
timeout=60,
)
print(response.status_code, response.json()){
"object": "list",
"success": true,
"data": [
{
"id": "seedance2.0",
"object": "model",
"created": 1626777600,
"owned_by": "custom",
"supported_endpoint_types": [
"openai-video"
]
},
{
"id": "gpt-image-2.6",
"object": "model",
"created": 1626777600,
"owned_by": "custom",
"supported_endpoint_types": [
"image-generation"
]
}
]
}