跳到正文

列出模型

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/videos
      • image-generation图片模型,使用 /v1/images/*

错误

HTTPcode原因与处理
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"
      ]
    }
  ]
}
API 参考概述
鉴权、素材地址、幂等与错误格式。
接入文档
从准备密钥到下载结果的完整流程。
最后更新