GET
https://openmodal.net/v1/models接口描述
鉴权:Bearer API Key
描述:返回平台支持的模型列表,包含模型需要的出入参(用于 /v1/tasks 接口发起任务时传入模型参数)
请求参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| capability | string | null | 否 | 可选。按能力过滤(取 GET /v1/capabilities 返回的 data[].id);不传返回全部模型 |
请求示例
# 全部模型 curl https://openmodal.net/v1/models \ -H "Authorization: Bearer $OPENMODAL_API_KEY" # 只看某个能力下的模型(capability 取自 /v1/capabilities 返回) curl "https://openmodal.net/v1/models?capability=img_sr" \ -H "Authorization: Bearer $OPENMODAL_API_KEY"
响应状态
| 状态码 | 说明 |
|---|---|
| 200 | 成功返回模型列表(含每个模型的出入参契约) |
| 401 | API Key 缺失或无效(invalid_api_key) |
| 422 | Validation Error |
| 429 | 超出每日调用限额(daily_quota_exceeded) |
| 503 | 模型过载或排队已满(model_overloaded) |
响应参数
成功响应(200)的 body 结构:
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
| data | PublicModel[] | 是 | 模型列表,仅含当前有节点服务的模型 |
| data.capability | string | 是 | 能力类型:img_sr(超分)/ id_photo(证件照) / vid_redact(视频脱敏)/ tts(语音合成)等 |
| data.created | integer | 是 | 模型注册时间(Unix 时间戳,秒) |
| data.description | string | null | 否 | 模型描述 |
| data.id | string | 是 | 模型 ID,创建任务时在 model 字段传入 |
| data.input_schema | object | null | 是 | 请求参数契约(JSON Schema):构造 POST /v1/tasks 的 input 时以此为准 |
| data.name | string | null | 否 | 模型显示名 |
| data.object | "model" | 是 | 对象类型,固定为 model |
| data.output_schema | object | null | 是 | 结果结构契约(JSON Schema):解读任务 output 时以此为准 |
| data.owned_by | string | null | 否 | 模型提供方 |
| object | "list" | 是 | 对象类型,固定为 list |
input_schema 关键字说明(请求参数契约)
| 关键字 | 说明 |
|---|---|
| type | 固定为 "object",表示 input 是一个参数对象 |
| required | 必填参数名列表:出现在此数组中的参数,调用 POST /v1/tasks 时必须在 input 里传入,缺了会返回 422 |
| properties | 全部参数的定义,键为参数名,值为该参数的规则(类型/说明/取值范围),见下方各子关键字 |
| properties.<参数名>.type | 参数类型:string(字符串)/ integer(整数)/ boolean(布尔)等 |
| properties.<参数名>.description | 该参数的含义与传法说明 |
| properties.<参数名>.enum | 可选值列表:参数只能取列出的值之一(如放大倍数只能传 2 或 4) |
| properties.<参数名>.default | 默认值:不传该参数时使用此值 |
| additionalProperties | 是否允许传入 schema 未定义的字段;为 false 时多传会返回 422 |
output_schema 关键字说明(结果结构契约)
| 关键字 | 说明 |
|---|---|
| type | 固定为 "object",表示 output 是一个结果对象 |
| required | 必有字段列表:任务 succeeded 后,output 中一定包含这些字段 |
| properties | 全部结果的定义,键为字段名,值为该字段的规则(类型/说明) |
| properties.<字段名>.type | 字段类型:string(字符串)/ integer(整数)/ array(数组)等 |
| properties.<字段名>.description | 该字段的内容说明(如产物文件名、预签名 URL 等) |
两个 schema 均为标准 JSON Schema 文档,任务实际返回的 output 与 output_schema 完全一致。其中 output_file 字段的值是对象存储 预签名下载地址(7 天内有效,可直接下载)。
响应示例
{
"object": "list",
"data": [
{
"id": "vosr2",
"object": "model",
"created": 1760000000,
"owned_by": "cpullmhub",
"capability": "img_sr",
"name": "基础版",
"description": "快速图片超分:几秒出图,画面整体变清晰,内容与构图保持不变,支持 2x/4x 放大。",
"input_schema": {
"type": "object",
"required": [
"image_b64"
],
"additionalProperties": false,
"properties": {
"image_b64": {
"type": "string",
"description": "原图 base64(支持 data URI)"
},
"scale": {
"type": "integer",
"enum": [
2,
4
],
"default": 2,
"description": "放大倍数"
}
}
},
"output_schema": {
"type": "object",
"required": [
"output_file"
],
"properties": {
"output_file": {
"type": "string",
"description": "超分结果图文件名"
}
}
}
}
]
}