Skip to content

获取模型详情

查询单模型的详细能力、权限与定价摘要。详情对象包含了列表中没有的 capabilities(支持的协议与参数)、pricing_hint(计费模式摘要)以及 JWT 登录后的 entitlement

若需批量查询,使用 获取模型详情 · 批量


Endpoint

MethodURL
GET{TRINITY_BASE_URL}/models/{modelCode}

Base URL

Base URLhttps://api.trinitydesk.ai/v1
协议HTTPS
bash
export TRINITY_BASE_URL="https://api.trinitydesk.ai/v1"
export TRINITY_API_KEY="xh-..."

Headers

Header必填说明
AuthorizationBearer <TRINITY_API_KEY>
Acceptapplication/json

路径参数

参数必填类型说明
modelCodestring模型 ID(与列表返回的 id 一致);大小写敏感

查询参数

参数必填类型说明
modality否(推荐)stringtext | 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}"

返回字段

字段类型必有说明
objectstring固定 "model"
idstring模型编码
modality_typestringtext | image | video
createdintegerUnix 时间戳(秒),模型上架时间
owned_bystring原研发方标识(如 openaianthropic
display_namestring通常有模型对外展示名
metadataobject | null通常有模型元数据,见下方按模态描述
capabilitiesobject | null模型支持的接口、参数和限制,见说明
pricing_hintobject | null通常有计费模式摘要,完整价目请调 GET /v1/prices
entitlementobject | null仅 JWT当前工作区的调用权限标注

metadata(按模态)

详情接口的 metadata 在列表 metadata 基础上增加部分字段。仅返回白名单字段,完整参数 schema 见 capabilities

生文 / 多模态(modality_typetext / multimodal

字段类型说明
context_lengthinteger上下文长度(token)
max_tokeninteger单次最大输出 token
user_input_price_per_million_usdnumber输入 token 展示价(USD / 百万 token)
user_output_price_per_million_usdnumber输出 token 展示价(USD / 百万 token)
async_support_modestringsync_only | async_only | both

生图(modality_type=image

字段类型说明
metered_charge_unitstring固定 image_count(按张计费)
min_user_unit_price_usdnumber单张最低展示价(USD)
async_support_modestringsync_only | async_only | both

生视频(modality_type=video

字段类型说明
metered_charge_unitstring计费单位,常见 video_secondvideo_tokenvideo_task
min_user_unit_price_usdnumber最低展示单价(USD;含义随计费单位而定)
async_support_modestring通常 async_only

copy_i18n(全部模态共用)

字段类型说明
copy_i18nobject | null多语言文案,键为语言代码,值为 { short_summary, description_long, feature_tags[] }

capabilities

按模态返回支持的接口、限制和参数列表。仅返回该模型 supported 的项,不支持项整键省略。每个参数的值对象可能包含:

  • enum:可取值列表
  • range{ min, max } 范围
  • default:默认值
  • type:数据类型(booleanstringinteger
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 结构:

模态顶层键子结构
textinterfaces[]supports_multimodal_inputparams支持的协议入口列表、多模态输入能力、请求体参数键与可取值
imageasync_modelimitsparamsmodel_specific_params调用方式、限制(如参考图上限)、image_config 参数、模型特有参数
videoasync_modegeneration_modes[]limitsparamsmodel_specific_params异步模式、生成模式枚举、限制和请求体参数

pricing_hint

字段类型说明
pricing_modestring计价模式标识,如 legacyinput_output_matrixflatimage_tieredvideo_tiered
charge_unitstring计费单位,如 tokenimage_countvideo_second
updated_atstring价目更新时间(ISO 8601)

完整价目和分段价请调用 GET /v1/prices?model={modelCode}

entitlement(仅 JWT)

字段类型说明
allowedboolean当前工作区是否有调用权限
browse_allowlistboolean是否在浏览白名单内
call_allowedboolean是否可以发起推理调用

未登录或 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

MethodURL
GET{TRINITY_BASE_URL}/models/details

查询参数

参数必填说明
model模型 code,可重复传参或逗号分隔,如 model=a&model=bmodel=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": { ... }, ... }
  ]
}

错误码

HTTPerror.code场景
400invalid_model_code空的或非法 modelCode
400invalid_modality非法 modality 枚举值
404model_not_found模型未上架、不存在或当前 Key 无访问权限
404ambiguous_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', [])}")

相关

© Trinity AI