模型(Models)
获取当前虚拟 Key 可以使用的模型列表。
模型权限
不同虚拟 Key 请求该接口时,可能返回不同的模型列表。接口只返回当前虚拟 Key 有权限访问的模型。
列出所有模型
获取当前虚拟 Key 可用的模型列表。
请求接口
http
GET https://api.nexusmodels.cn/v1/models请求头
http
Authorization: Bearer YOUR_NEXUSMODELS_API_KEY请求示例
bash
curl -sS \
'https://api.nexusmodels.cn/v1/models' \
-H 'Authorization: Bearer YOUR_NEXUSMODELS_API_KEY'响应
成功时返回:
http
200 OK响应示例
json
{
"object": "list",
"data": [
{
"id": "gpt-5.4",
"object": "model",
"created": 1788163200,
"owned_by": "openai"
},
{
"id": "claude-sonnet-4-6",
"object": "model",
"created": 1788163200,
"owned_by": "anthropic"
},
{
"id": "gemini-3-flash",
"object": "model",
"created": 1788163200,
"owned_by": "google"
}
]
}响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
object | string | 对象类型,通常为 list |
data | array | 当前虚拟 Key 可使用的模型列表 |
data[].id | string | 调用模型时使用的公开模型名称 |
data[].object | string | 对象类型,通常为 model |
data[].created | integer | 模型记录的创建时间 |
data[].owned_by | string | 模型所属提供方 |
使用模型
调用其他模型接口时,model 参数必须使用模型列表接口返回的 id。
json
{
"model": "gpt-5.4"
}聊天请求示例:
bash
curl -sS -X POST \
'https://api.nexusmodels.cn/v1/chat/completions' \
-H 'Authorization: Bearer YOUR_NEXUSMODELS_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-5.4",
"messages": [
{
"role": "user",
"content": "你好"
}
]
}'常见错误
| 状态码 | 说明 |
|---|---|
401 | API Key 缺失或无效 |
403 | 当前虚拟 Key 无权访问该资源 |
404 | 模型不存在,或当前虚拟 Key 无权访问该模型 |
429 | 超过预算、RPM 或 TPM 限制 |
500 | 网关或模型提供方内部错误 |