# 模型发现

GET /v1/models

获取当前账户可用的图片、视频模型及其参数。

## 认证

请求头 Authorization: Bearer YOUR_API_KEY。API Key 可在网站“开发者 API”页面创建。

## 查询参数

| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| type | string | 否 | image、video 或 all；默认 video |

## 响应 data.models[]

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| id | string | 生成请求的 model 值 |
| type | string | image 或 video |
| name | string | 模型显示名称 |
| description | string | 模型说明 |
| resolutions | string[] | 清晰度枚举，例如 1K、2K、4K 或 720p、1080p |
| aspect_ratios | string[] | 比例枚举，例如 16:9 |
| durations | integer[] | 可选时长（秒），图片为空数组 |
| supports | object | image/video/audio 参考能力，multimodal 为混合媒体/显式引用能力 |
| reference_limits | object | image/video/audio 各类型最大数量；null 表示未设置数量配置 |
| parameter_combinations | object[] | 可用 duration 与 resolution 组合；空数组表示无组合表，仍需满足其他枚举 |
| billing_type | string | per_use、per_resolution 或 per_second 等计费方式；具体费用使用报价接口 |
| member_only | boolean | 是否会员专用 |

只有当前账户可用且已启用的模型会返回。未配置的能力枚举可能为空，此时可以通过报价接口验证参数。

## 调用示例

设置环境变量 DRAMAGEN_API_KEY（用户密钥）。Python 需要 requests，JavaScript 使用 Node.js 20+。

### cURL

```bash
curl --request GET "https://api.storymo.art/v1/models?type=all" \
  --header "Authorization: Bearer $DRAMAGEN_API_KEY"
```

### Python

```python
import os
import requests

api_origin = "https://api.storymo.art"
headers = {
  "Authorization": "Bearer YOUR_API_KEY"
}
headers["Authorization"] = "Bearer " + os.environ["DRAMAGEN_API_KEY"]
response = requests.request("GET", api_origin + "/v1/models?type=all", headers=headers, timeout=360)
response.raise_for_status()
result = response.json()
if result["code"] != "ok":
    raise RuntimeError(result)
print(result["data"])
```

### JavaScript

```javascript
const apiOrigin = "https://api.storymo.art";
const headers = {
  "Authorization": "Bearer YOUR_API_KEY"
};
headers.Authorization = `Bearer ${process.env.DRAMAGEN_API_KEY}`;
const response = await fetch(apiOrigin + "/v1/models?type=all", {
  method: "GET",
  headers,
});
const result = await response.json();
if (!response.ok || result.code !== "ok") throw new Error(JSON.stringify(result));
console.log(result.data);
```
