获取模型详情
查询单模型的详细能力、权限与定价摘要。详情对象包含了列表中没有的 capabilities(支持的协议与参数)、pricing_hint(计费模式摘要)以及 JWT 登录后的 entitlement。
若需批量查询,使用 获取模型详情 · 批量。
Endpoint
| Method | URL |
|---|---|
GET | {TRINITY_BASE_URL}/models/{modelCode} |
Base URL
| 项 | 值 |
|---|---|
| Base URL | https://api.trinitydesk.ai/v1 |
| 协议 | HTTPS |
bash
export TRINITY_BASE_URL="https://api.trinitydesk.ai/v1"
export TRINITY_API_KEY="xh-..."Headers
| Header | 必填 | 说明 |
|---|---|---|
Authorization | 是 | Bearer <TRINITY_API_KEY> |
Accept | 否 | application/json |
路径参数
| 参数 | 必填 | 类型 | 说明 |
|---|---|---|---|
modelCode | 是 | string | 模型 ID(与列表返回的 id 一致);大小写敏感 |
查询参数
| 参数 | 必填 | 类型 | 说明 |
|---|---|---|---|
modality | 否(推荐) | string | text | image | video;同名 code 跨模态时用于消歧 |
同名模型可能有多个模态(例如 kling-3.0-omni 同时存在 image 和 video 两个版本)。若不传 modality 且命中多个模态,返回 404 ambiguous_model_code。建议始终携带当前上下文已知的模态值。
请求示例
bash
curl -sS "${TRINITY_BASE_URL}/models/gpt-5.5" \
-H "Authorization: Bearer ${TRINITY_API_KEY}"
# 带模态消歧
curl -sS "${TRINITY_BASE_URL}/models/kling-3.0-omni?modality=video" \
-H "Authorization: Bearer ${TRINITY_API_KEY}"返回字段
| 字段 | 类型 | 必有 | 说明 |
|---|---|---|---|
object | string | 是 | 固定 "model" |
id | string | 是 | 模型编码 |
modality_type | string | 是 | text | image | video |
created | integer | 是 | Unix 时间戳(秒),模型上架时间 |
owned_by | string | 是 | 原研发方标识(如 openai、anthropic) |
display_name | string | 通常有 | 模型对外展示名 |
metadata | object | null | 通常有 | 模型元数据,见下方按模态描述 |
capabilities | object | null | 有 | 模型支持的接口、参数和限制,见说明 |
pricing_hint | object | null | 通常有 | 计费模式摘要,完整价目请调 GET /v1/prices |
entitlement | object | null | 仅 JWT | 当前工作区的调用权限标注 |
metadata(按模态)
详情接口的 metadata 在列表 metadata 基础上增加部分字段。仅返回白名单字段,完整参数 schema 见 capabilities。
生文 / 多模态(modality_type 为 text / multimodal)
| 字段 | 类型 | 说明 |
|---|---|---|
context_length | integer | 上下文长度(token) |
max_token | integer | 单次最大输出 token |
user_input_price_per_million_usd | number | 输入 token 展示价(USD / 百万 token) |
user_output_price_per_million_usd | number | 输出 token 展示价(USD / 百万 token) |
async_support_mode | string | sync_only | async_only | both |
生图(modality_type=image)
| 字段 | 类型 | 说明 |
|---|---|---|
metered_charge_unit | string | 固定 image_count(按张计费) |
min_user_unit_price_usd | number | 单张最低展示价(USD) |
async_support_mode | string | sync_only | async_only | both |
生视频(modality_type=video)
| 字段 | 类型 | 说明 |
|---|---|---|
metered_charge_unit | string | 计费单位,常见 video_second、video_token、video_task |
min_user_unit_price_usd | number | 最低展示单价(USD;含义随计费单位而定) |
async_support_mode | string | 通常 async_only |
copy_i18n(全部模态共用)
| 字段 | 类型 | 说明 |
|---|---|---|
copy_i18n | object | null | 多语言文案,键为语言代码,值为 { short_summary, description_long, feature_tags[] } |
capabilities
按模态返回支持的接口、限制和参数列表。仅返回该模型 supported 的项,不支持项整键省略。每个参数的值对象可能包含:
enum:可取值列表range:{ min, max }范围default:默认值type:数据类型(boolean、string、integer)
json
{
"text": {
"interfaces": ["text.chat_completions", "text.responses"],
"supports_multimodal_input": false,
"params": {
"thinking_enabled": {},
"reasoning_effort": { "enum": ["low", "medium", "high"] }
}
},
"image": null,
"video": null
}各模态的 capabilities 结构:
| 模态 | 顶层键 | 子结构 |
|---|---|---|
text | interfaces[]、supports_multimodal_input、params | 支持的协议入口列表、多模态输入能力、请求体参数键与可取值 |
image | async_mode、limits、params、model_specific_params | 调用方式、限制(如参考图上限)、image_config 参数、模型特有参数 |
video | async_mode、generation_modes[]、limits、params、model_specific_params | 异步模式、生成模式枚举、限制和请求体参数 |
pricing_hint
| 字段 | 类型 | 说明 |
|---|---|---|
pricing_mode | string | 计价模式标识,如 legacy、input_output_matrix、flat、image_tiered、video_tiered |
charge_unit | string | 计费单位,如 token、image_count、video_second |
updated_at | string | 价目更新时间(ISO 8601) |
完整价目和分段价请调用 GET /v1/prices?model={modelCode}。
entitlement(仅 JWT)
| 字段 | 类型 | 说明 |
|---|---|---|
allowed | boolean | 当前工作区是否有调用权限 |
browse_allowlist | boolean | 是否在浏览白名单内 |
call_allowed | boolean | 是否可以发起推理调用 |
未登录或 API Key 鉴权时不返回本字段。
返回示例
生文
json
{
"object": "model",
"id": "gpt-5.5",
"modality_type": "text",
"created": 1700000000,
"owned_by": "trinity",
"display_name": "GPT-5.5",
"metadata": {
"context_length": 128000,
"max_token": 8192,
"user_input_price_per_million_usd": 0.15,
"user_output_price_per_million_usd": 0.60,
"async_support_mode": "both",
"copy_i18n": {
"zh": {
"short_summary": "新一代推理模型",
"description_long": "适用于复杂推理和多步任务。",
"feature_tags": ["推理", "函数调用"]
}
}
},
"capabilities": {
"text": {
"interfaces": ["text.chat_completions", "text.responses"],
"supports_multimodal_input": true,
"params": {
"thinking_enabled": {},
"reasoning_effort": { "enum": ["low", "medium", "high"] },
"response_format": { "enum": ["text", "json_object"] }
}
},
"image": null,
"video": null
},
"pricing_hint": {
"pricing_mode": "input_output_matrix",
"charge_unit": "token",
"updated_at": "2026-07-01T08:00:00Z"
}
}生视频
json
{
"object": "model",
"id": "kling-2.6",
"modality_type": "video",
"created": 1700000200,
"owned_by": "trinity",
"display_name": "KLING 2.6",
"metadata": {
"metered_charge_unit": "video_second",
"min_user_unit_price_usd": 0.08,
"async_support_mode": "async_only",
"copy_i18n": {
"zh": {
"short_summary": "高质量文生视频",
"description_long": "支持文生视频、图生视频。",
"feature_tags": ["文生视频", "首尾帧"]
}
}
},
"capabilities": {
"video": {
"async_mode": "async_only",
"generation_modes": ["text_to_video", "image_to_video", "first_last_frame"],
"limits": {
"default_duration_sec": 5,
"max_reference_images": 4
},
"params": {
"duration_sec": { "range": { "min": 2, "max": 10 }, "default": 5 },
"resolution": { "enum": ["720p", "1080p"] },
"aspect_ratio": { "enum": ["16:9", "9:16"] },
"generate_audio": { "type": "boolean", "default": false }
}
},
"text": null,
"image": null
},
"pricing_hint": {
"pricing_mode": "video_tiered",
"charge_unit": "video_second",
"updated_at": "2026-07-01T08:00:00Z"
}
}JWT 权限标注
json
{
"object": "model",
"id": "gpt-5.5",
"modality_type": "text",
"created": 1700000000,
"owned_by": "trinity",
"display_name": "GPT-5.5",
"metadata": { ... },
"capabilities": { ... },
"pricing_hint": { ... },
"entitlement": {
"allowed": true,
"browse_allowlist": true,
"call_allowed": true
}
}批量获取模型详情
批量查询多个模型的详情,不支持或无法消歧的 code 被跳过(部分成功),不导致整批失败。
Endpoint
| Method | URL |
|---|---|
GET | {TRINITY_BASE_URL}/models/details |
查询参数
| 参数 | 必填 | 说明 |
|---|---|---|
model | 是 | 模型 code,可重复传参或逗号分隔,如 model=a&model=b 或 model=a,b;单次最多 50 个 |
modality | 否 | 消歧,同单模型规则 |
请求示例
bash
curl -sS "${TRINITY_BASE_URL}/models/details?model=gpt-5.5&model=deepseek-v3.2" \
-H "Authorization: Bearer ${TRINITY_API_KEY}"返回示例
json
{
"object": "list",
"data": [
{ "object": "model", "id": "gpt-5.5", "modality_type": "text", "capabilities": { ... }, ... },
{ "object": "model", "id": "deepseek-v3.2", "modality_type": "text", "capabilities": { ... }, ... }
]
}错误码
| HTTP | error.code | 场景 |
|---|---|---|
| 400 | invalid_model_code | 空的或非法 modelCode |
| 400 | invalid_modality | 非法 modality 枚举值 |
| 404 | model_not_found | 模型未上架、不存在或当前 Key 无访问权限 |
| 404 | ambiguous_model_code | 同名 code 匹配多个模态且未传 modality |
完整错误码见 错误与调试。
Python 示例
python
import os
import requests
url = f"{os.environ['TRINITY_BASE_URL']}/models/gpt-5.5"
r = requests.get(
url,
headers={"Authorization": f"Bearer {os.environ['TRINITY_API_KEY']}"},
timeout=60,
)
r.raise_for_status()
detail = r.json()
print(f"名称: {detail['display_name']}")
print(f"模态: {detail['modality_type']}")
print(f"计费模式: {detail.get('pricing_hint', {}).get('pricing_mode')}")
print(f"支持的接口: {detail.get('capabilities', {}).get('text', {}).get('interfaces', [])}")