aimlapi-media-gen
根据提示通过 AIMLAPI 生成图像或视频。当 Codex 需要具有重试、显式用户代理标头和异步视频轮询功能的可靠 AI/ML API 媒体生成时使用。
安装 / 下载方式
TotalClaw CLI推荐
totalclaw skills install shop:totalclaw:totalclaw~aimlapihello-aiml-image-videocURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~aimlapihello-aiml-image-video/file -o aimlapihello-aiml-image-video.md# AIMLAPI Media Generation
## Overview
Generate images and videos via AIMLAPI with scripts that include retries, API key file fallback, verbose logs, and required `User-Agent` headers on every request.
## Quick start
```bash
export AIMLAPI_API_KEY="sk-aimlapi-..."
python3 {baseDir}/scripts/gen_image.py --prompt "ultra-detailed studio photo of a lobster astronaut"
python3 {baseDir}/scripts/gen_video.py --prompt "slow drone shot of a foggy forest"
```
## Tasks
### Generate images
Use `scripts/gen_image.py` with `/v1/images/generations`.
```bash
python3 {baseDir}/scripts/gen_image.py \
--prompt "cozy cabin in a snowy forest" \
--model aimlapi/openai/gpt-image-1 \
--size 1024x1024 \
--count 2 \
--retry-max 4 \
--user-agent "openclaw-custom/1.0" \
--out-dir ./out/images
```
### Generate videos (async AIMLAPI flow)
Use `scripts/gen_video.py` with the real async flow:
1. `POST /v2/video/generations` (create task)
2. `GET /v2/video/generations?generation_id=...` (poll status)
3. download `video.url` when status is completed
```bash
python3 {baseDir}/scripts/gen_video.py \
--model google/veo-3.1-t2v-fast \
--prompt "time-lapse of clouds over a mountain range" \
--poll-interval 10 \
--max-wait 1000 \
--user-agent "openclaw-custom/1.0" \
--out-dir ./out/videos
```
## References
- `references/aimlapi-media.md`: endpoint notes, async polling statuses, and troubleshooting.
- `README.md`: changelog-style summary of new instructions.
---
## 中文说明
# AIMLAPI 媒体生成
## 概述
通过 AIMLAPI 生成图像和视频,脚本包含重试、API 密钥文件回退、详细日志,以及每次请求所需的 `User-Agent` 标头。
## 快速开始
```bash
export AIMLAPI_API_KEY="sk-aimlapi-..."
python3 {baseDir}/scripts/gen_image.py --prompt "ultra-detailed studio photo of a lobster astronaut"
python3 {baseDir}/scripts/gen_video.py --prompt "slow drone shot of a foggy forest"
```
## 任务
### 生成图像
使用 `scripts/gen_image.py` 搭配 `/v1/images/generations`。
```bash
python3 {baseDir}/scripts/gen_image.py \
--prompt "cozy cabin in a snowy forest" \
--model aimlapi/openai/gpt-image-1 \
--size 1024x1024 \
--count 2 \
--retry-max 4 \
--user-agent "openclaw-custom/1.0" \
--out-dir ./out/images
```
### 生成视频(AIMLAPI 异步流程)
使用 `scripts/gen_video.py` 搭配真实的异步流程:
1. `POST /v2/video/generations`(创建任务)
2. `GET /v2/video/generations?generation_id=...`(轮询状态)
3. 当状态为已完成时下载 `video.url`
```bash
python3 {baseDir}/scripts/gen_video.py \
--model google/veo-3.1-t2v-fast \
--prompt "time-lapse of clouds over a mountain range" \
--poll-interval 10 \
--max-wait 1000 \
--user-agent "openclaw-custom/1.0" \
--out-dir ./out/videos
```
## 参考资料
- `references/aimlapi-media.md`:端点说明、异步轮询状态以及故障排查。
- `README.md`:以变更日志形式总结的新指令。