模型/模型查询

列出可用模型、查看端点提示,并复制可请求的 API 模型 ID。

模型查询

查询可用模型列表。模型 ID 的唯一准入来源。

  • 方法:GET
  • 路径:/v1/models
  • 地址:https://api.unigateway.ai/v1/models

查询

curl https://api.unigateway.ai/v1/models \
  -H "Authorization: Bearer $UNIGATEWAY_API_KEY"

响应

{
  "success": true,
  "object": "list",
  "data": [
    {
      "id": "gpt-5.4",
      "object": "model",
      "created": 1760000000,
      "owned_by": "custom",
      "supported_endpoint_types": ["chat_completions"]
    },
    {
      "id": "gemini-3-pro-image-preview",
      "object": "model",
      "created": 1760000000,
      "owned_by": "vertex-ai",
      "supported_endpoint_types": ["gemini"]
    }
  ]
}

id 字段是请求中使用的精确模型 ID。

重要字段:

字段说明
id精确请求模型 ID。请求中复制这个值。
owned_byProvider 或上游家族。
supported_endpoint_types端点族提示,例如 chat_completionsgeminiimagesembeddingsrerank

以实时返回为准,不要依赖外部截图或过期示例。模型可用性因账号而异。

按场景选型

场景推荐家族说明
通用对话GPT / Claude优先选择非预览、稳定的 ID
生产环境流量GPT / Claude / Gemini 中档请求体保持保守兼容
低延迟交互账号内更快的模型全量切流前先验证质量
多语言生成GPT / Claude / Gemini切换家族后回归提示词效果
向量 / 重排专用模型上线前确认端点支持
视频生成独立的视频调用面不与聊天共用模型

回退链

启动时或短周期缓存拉取模型列表。按业务场景固定模型 ID,配置跨家族回退。

示例回退链路:

  1. gpt-5.4
  2. claude-sonnet-4-6
  3. gemini-3-pro-preview

模型可用性是动态的。用真实请求验证能力,不要只靠模型名推断。

展示名与 API ID

模型库可能为了易读展示产品名或昵称。请求时始终使用 API 返回的 id 字段。

例如:Nano Banana Pro 是产品 / 展示名,gemini-3-pro-image-preview 才是可请求的 API 模型 ID。

Example request

Run it in your stack

Pick the SDK style that matches your app and copy the snippet directly into your project.

from openai import OpenAI

client = OpenAI(
    api_key="<YOUR_UNIGATEWAY_API_KEY>",
    base_url="https://api.unigateway.ai/v1",
)

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