获取模型列表
GET /v1/models
获取当前可用的模型列表。
根据请求头自动识别返回格式:
- 包含
x-api-key和anthropic-version头时返回 Anthropic 格式 - 包含
x-goog-api-key头或key查询参数时返回 Gemini 格式 - 其他情况返回 OpenAI 格式
基本信息
| 项目 | 内容 |
|---|---|
| Base URL | https://www.yunzhuhub.cn |
| 标签 | 获取模型列表 |
| Operation ID | listModels |
认证
- BearerAuth:使用 Bearer Token 认证。 格式:
Authorization: Bearer sk-xxxxxx
密钥安全
请只使用你自己的 API Key。示例中的 <YOUR_API_KEY> 必须在本地替换,不要把真实密钥提交到代码仓库或发送给他人。
参数
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
key | query | string | 否 | Google API Key (用于 Gemini 格式) |
x-api-key | header | string | 否 | Anthropic API Key (用于 Claude 格式) |
anthropic-version | header | string | 否 | Anthropic API 版本 |
x-goog-api-key | header | string | 否 | Google API Key (用于 Gemini 格式) |
请求体
此接口没有请求体。
请求示例
以下示例只用于复制到本地终端,不会从文档站发送请求。
bash
curl --request GET 'https://www.yunzhuhub.cn/v1/models' \
--header 'Authorization: Bearer <YOUR_API_KEY>'响应
200 成功获取模型列表
json
{
"title": "ModelsResponse",
"type": "object",
"properties": {
"object": {
"type": "string",
"example": "list"
},
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Model"
}
}
}
}401 认证失败
json
{
"title": "ErrorResponse",
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "错误信息"
},
"type": {
"type": "string",
"description": "错误类型"
},
"param": {
"type": "string",
"description": "相关参数",
"nullable": true
},
"code": {
"type": "string",
"description": "错误代码",
"nullable": true
}
}
}
}
}