跳转至

模型列表

1. 概述

获取网关当前支持的所有可用模型列表。

2. 请求说明

  • 请求方法: GET
  • 请求地址:

    https://gateway.serevixai.ai/v1/models
    

3. 请求参数

3.1 Header 参数

参数名称 类型 必填 说明 示例值
Authorization string 身份验证所需的 API_KEY,格式 Bearer $YOUR_API_KEY Bearer $YOUR_API_KEY

4. 返回说明

状态码 说明 Schema
200 成功获取模型列表 ModelsResponse
401 认证失败 ErrorResponse

ModelsResponse

字段 类型 说明
data array 模型对象数组,每项见下
object string 固定值 list
success boolean 请求是否成功,成功时为 true

Model 对象

字段 类型 说明
id string 模型 ID,可直接用于接口调用,如 o3-mini-2025-01-31-medium
object string 固定值 model
created number 模型创建时间(Unix 时间戳)
owned_by string 模型归属方,如 openai
supported_endpoint_types array 该模型支持的接口协议类型,如 ["openai"]

5. 请求示例

GET /v1/models
Authorization: Bearer $YOUR_API_KEY
curl https://gateway.serevixai.ai/v1/models \
  -H "Authorization: Bearer $YOUR_API_KEY"
package main

import (
    "context"
    "fmt"

    "github.com/openai/openai-go"
    "github.com/openai/openai-go/option"
)

func main() {
    client := openai.NewClient(
        option.WithAPIKey("$YOUR_API_KEY"),
        option.WithBaseURL("https://gateway.serevixai.ai/v1"),
    )

    models, err := client.Models.List(context.Background())
    if err != nil {
        fmt.Println("error:", err)
        return
    }

    for _, m := range models.Data {
        fmt.Println(m.ID)
    }
}
from openai import OpenAI

client = OpenAI(
    api_key="$YOUR_API_KEY",
    base_url="https://gateway.serevixai.ai/v1"
)

models = client.models.list()
for model in models.data:
    print(model.id)

6. 返回示例

{
  "data": [
    {
      "id": "o3-mini-2025-01-31-medium",
      "object": "model",
      "created": 1626777600,
      "owned_by": "openai",
      "supported_endpoint_types": [
        "openai"
      ]
    }
  ],
  "object": "list",
  "success": true
}