> ## Documentation Index
> Fetch the complete documentation index at: https://aisa.one/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> - Base URLs: models `https://api.aisa.one/v1` (Gemini GenerateContent: `https://api.aisa.one/v1beta`); data APIs `https://api.aisa.one/apis/v1`. The `servers` of each operation in https://aisa.one/openapi.yaml is authoritative.
> - Auth: `Authorization: Bearer $AISA_API_KEY`. Never print, log, or commit the key.
> - MCP (preferred for agents): `https://mcp.aisa.one/mcp`, signed in with OAuth, so there is no key to paste.
> - Agent Skill: `npx skills add AIsa-team/agent-skills --skill aisa`. Fallback with the AIsa CLI: `aisa skills install aisa`.
> - Spending: docs, https://aisa.one/models, https://aisa.one/api, `/v1/models`, and MCP `search`, `list_categories`, `get_details`, `batch_quote`, and the `account` operation are free. Quote the exact calls before running them (MCP `batch_quote`, CLI `aisa quote --json`). If the quote reports `auto_execute_eligible: true`, run it unless the user set a tighter limit or asked only for a quote. Otherwise, tell the user in one message the planned calls, the quoted price, and a total USD budget for the task, then wait for approval. Direct HTTP calls follow the stricter rule at https://aisa.one/docs/get-started/cli.md#direct-http-fallback. Do not make paid calls to test availability. Full rule: https://aisa.one/llms.txt

# Media Gen

> 通过 AIsa 的图像与视频路由，利用 Seedream、Wan 和 GPT Image 模型为自主智能体提供图像与视频生成能力。

[在 GitHub 上查看 →](https://github.com/AIsa-team/agent-skills/tree/main/creative/media-gen)

**使用单个 AIsa API key 生成图像与视频**。该 Skill 指引你的智能体针对图像或视频请求选用相应的模型和路由，并内置了用于 Seedream 图像生成的 `media_gen_client.py`。

## 安装

```bash npx skills theme={null}
npx skills add AIsa-team/agent-skills --skill media-gen
```

```bash AIsa CLI theme={null}
npm install -g @aisa-one/cli
aisa skills install media-gen
```

安装完成后，启动一个新的智能体会话以便加载该 Skill。

## 智能体可以用它做什么？

> [card] 营销素材
>
> “生成一张小熊猫的超细节产品照，摄影棚布光，锐利对焦。”

> [card] 大画幅图像
>
> “生成 2048×2048 杂志封面：新黑色电影风格侦探肖像，胶片颗粒质感。”

> [card] 文生视频
>
> “黄昏时分霓虹赛博朋克天际线的宏大交代镜头，5 秒。”

> [card] 图生视频
>
> “以此参考图像为起点，镜头平缓推近并带有视差效果。”

## 环境要求

* Python 3 和 POSIX shell
* 环境变量中配置 `AISA_API_KEY`

生成调用根据模型的不同，按每次请求或每个输出从你的 AIsa 余额中计费。各模型类型的具体计费方式请参阅 [AI 模型价格](https://aisa.one/docs/zh/guides/pricing.md#模型)。

## 当前模型与路由

线上网关支持以下多媒体模型。查看 [`GET /v1/models`](https://aisa.one/docs/zh/guides/models) 获取当前列表；每个模型均列出了其首选路由。

| 类别 | 模型 | 路由 |
| - | - | - |
| 图像 | `seedream-5-0-260128`, `wan2.7-image`, `wan2.7-image-pro`, `gpt-image-2`, `gpt-image-2.5-flare`, `gpt-image-2.5-sunburst` | `POST /v1/images/generations` |
| 视频 | `wan2.7-t2v`, `wan2.7-i2v`, `wan2.7-r2v` | `POST /v1/video/generations`，随后 `GET /v1/video/generations/{task_id}` |

> [!WARNING]
>
> 该 Skill 内置的客户端目前仍指向较旧的路由和模型 ID。其 `image` 命令支持 Seedream（`--model seedream-5-0-260128`），但它会将 Wan 图像模型发送到 `/v1/chat/completions`（该端点已不再提供图像模型服务），且其 `video-*` 命令调用的是已废弃的视频路由。在该 Skill 更新之前，请通过上述路由生成 Wan 图像与视频，不要通过客户端。

* **Seedream** 会拒绝低于 3,686,400 像素的图像（例如 `1024×1024`）。请使用如 `1920x1920` 或 `2048x2048` 的尺寸。`wan2.7-image` 支持更小的尺寸。
* 视频生成是异步的：先创建任务，然后通过 `task_id` 轮询直至完成。
* Seedream 和 Wan 图像模型每次请求计费一次，与 `n` 无关；`gpt-image-*` 模型按其上报的 token 用量计费。可以在同一请求中添加 `X-AISA-Cost-Mode: quote` 先获取免费报价；详见 [计费与额度](https://aisa.one/docs/zh/guides/pricing.md)。

## 快速开始

使用该 Skill 的客户端（Seedream）：

```bash theme={null}
export AISA_API_KEY="your-key"

python3 scripts/media_gen_client.py image \
  --model seedream-5-0-260128 \
  --prompt "Neo-noir detective portrait, film grain" \
  --size 2048x2048 \
  --out out.png
```

任意图像模型，直接通过 HTTP 调用：

```bash theme={null}
curl -sS -X POST "https://api.aisa.one/v1/images/generations" \
  -H "Authorization: Bearer $AISA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wan2.7-image-pro",
    "prompt": "Ultra-detailed product shot of a red panda, studio lighting",
    "n": 1,
    "size": "2048x2048"
  }'
```

请求与响应字段详见 [图像生成](https://aisa.one/docs/zh/api-reference/chat/post_images-generations.md)。

## 开始使用

1. 在 [aisa.one](https://aisa.one) 注册并在控制台中创建 API key。
2. 在你的 Shell 中设置：`export AISA_API_KEY="your-key"`。
3. 使用 [安装](#安装) 中的任一命令安装该 Skill，然后启动一个新的智能体会话。

## 相关

> [card] [图像生成](https://aisa.one/docs/zh/api-reference/chat/post_images-generations.md)
>
> 兼容 OpenAI 的图像生成端点以及当前支持的图像模型。

> [card] [模型目录](https://aisa.one/docs/zh/guides/models.md)
>
> 当前的各模型 ID、模态和路由。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.