模型 API

查询 API Key 可见的模型列表及各模型支持的端点类型

模型接口用于查询当前 API Key 可见的模型列表,以及各模型支持的端点类型。调用其他能力前,建议先通过本接口确认可用模型。

接口一览

方法路径说明
GET/v1/models获取当前令牌可见的模型列表

模型筛选:其他接口请求体中的 model 字段须为本接口返回的 data[].idsupported_endpoint_types 指示该模型可用于哪些能力。


GET /v1/models

获取当前令牌可见的模型列表。

鉴权:Bearer Token

请求:无请求体

请求示例(curl)

curl https://www.yunsell.com/v1/models \
  -H "Authorization: Bearer sk-xxx"

响应体

HTTP 200

{
  "success": true,
  "object": "list",
  "data": [
    {
      "id": "gpt-4o",
      "object": "model",
      "created": 1626777600,
      "owned_by": "openai",
      "supported_endpoint_types": [
        "openai",
        "openai-response",
        "image-generation"
      ]
    },
    {
      "id": "agnes-video-v2.0",
      "object": "model",
      "created": 1626777600,
      "owned_by": "agnes-ai",
      "supported_endpoint_types": [
        "openai-video"
      ]
    }
  ]
}

响应字段

字段类型说明
successboolean是否成功
objectstring固定为 list
dataarray模型列表
data[].idstring模型 ID,其他接口 model 字段使用此值
data[].objectstring固定为 model
data[].creatednumberUnix 时间戳(秒)
data[].owned_bystring模型归属标识
data[].supported_endpoint_typesstring支持的端点类型
data[].tagsstring模型标签(若有)

supported_endpoint_types 取值

说明对应文档
openaiChat / Completions文本 API
openai-responseResponses 对话文本 API
image-generation图像生成 / 编辑图像 API
openai-video视频生成视频 API

失败响应

HTTP 200(业务失败)

{
  "success": false,
  "message": "get user group failed"
}
字段类型说明
successboolean固定为 false
messagestring失败原因

错误格式说明见 网关扩展错误