GET /v1/models
列出启用的模型、别名、功能以及特定于密钥的成本和使用成本率。
GET /v1/models
返回可用于经过身份验证的 API 密钥的每个已启用模型。价格是每百万代币以美元为单位的十进制字符串。
验证
Authorization: Bearer mg_live_...
x-api-key: mg_live_... 也被接受。
带有状态的按键 active 或者 frozen 可以阅读型号目录及其关键特定定价。冻结的密钥仍会被阻止与推理端点和需要活动密钥的其他帐户元数据端点连接。
要求
curl https://api.model-gate.com/v1/models \
-H "Authorization: Bearer mg_live_..."
回复
{
"object": "list",
"data": [
{
"id": "claude-opus-4.7",
"object": "model",
"owned_by": "anthropic",
"display_name": "Claude Opus 4.7",
"aliases": ["ch-47"],
"currency": "USD",
"pricing_unit": "per_1m_tokens",
"cost": {
"input": "0.2",
"output": "1",
"cache_read": "0.02",
"cache_write": "0.25",
"reasoning": "1"
},
"official_cost": {
"input": "1",
"output": "5",
"cache_read": "0.1",
"cache_write": "1.25",
"reasoning": "5"
},
"usage_cost": {
"input": "10",
"output": "50",
"cache_read": "1",
"cache_write": "12.5",
"reasoning": "50"
},
"usage_pricing": {
"basis": "official_price",
"multiplier": "10",
"inherited_from": "key"
},
"batch_cost": {
"input": "0.1",
"output": "0.5",
"cache_read": "0.01",
"cache_write": "0.125",
"reasoning": "0.5"
},
"batch_pricing": {
"multiplier": "0.5",
"applies_to": "claude_openai_compat_batches"
},
"context_length": 200000,
"context_window": 200000,
"max_input_tokens": 180000,
"max_output_tokens": 20000,
"max_completion_tokens": 20000,
"supports_streaming": true,
"supports_tools": true,
"supports_vision": true
}
]
}
价格字段
cost是用于借记账户余额的实际模型门费率。official_cost是保存的官方提供商目录费率。usage_cost是仅用于可重置 API 密钥和组使用限制的有效速率。usage_pricing标识已验证密钥的基础、乘数和继承源。- 当账户计费模板的批量系数不同于
1,batch_cost显示 Claude/OpenAI 兼容批次项目的有效实际费率batch_pricing.multiplier确定附加模型门系数。当系数为1。本国的async=true不使用该系数。
为了 official_price,每个显示 usage_cost 率是 official_cost × multiplier。为了 user_price, 这是 cost × multiplier。这些是每百万代币的目录费率。最终请求结算首先计算选定的基本请求金额并将其四舍五入到小数点后 10 位,然后应用乘数并将结果四舍五入到小数点后 10 位。
模型限制字段
context_window是面向客户端的上下文窗口值,当前等于context_length。max_input_tokens是已知时配置的最大输入令牌值。max_output_tokens是已知时配置的最大输出令牌值。max_completion_tokens是提供者样式模型元数据使用的完成限制兼容性字段。- 数值为
0意味着 Model Gate 没有该限制的配置值。具有可选手动限制覆盖的客户应保留该设置而不是处理0作为实际模型限制或猜测另一个值。
经过认证的 /models 页面还显示 语境, 最大输入, 和 最大输出 对于已知的非零值,因此普通用户不需要查询 API,只需将这些限制复制到客户端配置中即可。
错误
{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "missing API key"
}
}