liblib-ai-gen
通过 LiblibAI API 使用 Seedream4.5 生成图像并使用 Kling 生成视频。当用户要求使用 LiblibAI、Seedream 或 Kling 模型生成/创建图像、图片、插图或视频时使用。
安装 / 下载方式
TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~xtaq-liblib-ai-gencURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~xtaq-liblib-ai-gen/file -o xtaq-liblib-ai-gen.md# LiblibAI Image & Video Generation
Generate images (Seedream4.5) and videos (Kling) via LiblibAI's API.
## Prerequisites
Environment variables must be set:
- `LIB_ACCESS_KEY` — API access key
- `LIB_SECRET_KEY` — API secret key
## Usage
Run the CLI script at `scripts/liblib_client.py`:
```bash
# Generate image
python3 scripts/liblib_client.py image "a cute cat wearing a hat" --width 2048 --height 2048
# Generate video from text
python3 scripts/liblib_client.py text2video "a rocket launching into space" --model kling-v2-6 --duration 5
# Generate video from image
python3 scripts/liblib_client.py img2video "the cat turns its head" --start-frame https://example.com/cat.jpg
# Check task status
python3 scripts/liblib_client.py status <generateUuid>
```
## Image Generation (Seedream4.5)
- Endpoint: `POST /api/generate/seedreamV4`
- Model: `doubao-seedream-4-5-251128`
- Default size: 2048×2048. For 4.5, min total pixels = 3,686,400 (e.g. 2560×1440)
- Supports reference images (1-14), prompt expansion, and sequential image generation
- Options: `--width`, `--height`, `--count` (1-15), `--ref-images`, `--prompt-magic`
## Video Generation (Kling)
### Text-to-Video
- Endpoint: `POST /api/generate/video/kling/text2video`
- Models: `kling-v2-6` (latest, supports sound), `kling-v2-1-master`, `kling-v2-5-turbo`, etc.
- Options: `--model`, `--aspect` (16:9/9:16/1:1), `--duration` (5/10s), `--mode` (std/pro), `--sound` (on/off)
### Image-to-Video
- Endpoint: `POST /api/generate/video/kling/img2video`
- Provide `--start-frame` image URL; optionally `--end-frame` (v1-6 only)
- For kling-v2-6: uses `images` array instead of startFrame/endFrame
## Async Pattern
All generation tasks are async:
1. Submit task → get `generateUuid`
2. Poll `POST /api/generate/status` with `{ "generateUuid": "..." }`
3. Result contains `images[].imageUrl` or `videos[].videoUrl`
The script auto-polls by default. Use `--no-poll` to submit only.
## Notes
- QPS limit: 1 request/second for task submission
- Max concurrent tasks: 5
- Image URLs in results expire after 7 days
- For kling-v2-5-turbo and kling-v2-6, mode must be "pro" (default)
- Sound generation only supported on kling-v2-6+
---
## 中文说明
# LiblibAI 图像与视频生成
通过 LiblibAI 的 API 生成图像(Seedream4.5)和视频(Kling)。
## 前提条件
必须设置以下环境变量:
- `LIB_ACCESS_KEY` — API 访问密钥
- `LIB_SECRET_KEY` — API 密钥
## 用法
运行位于 `scripts/liblib_client.py` 的 CLI 脚本:
```bash
# Generate image
python3 scripts/liblib_client.py image "a cute cat wearing a hat" --width 2048 --height 2048
# Generate video from text
python3 scripts/liblib_client.py text2video "a rocket launching into space" --model kling-v2-6 --duration 5
# Generate video from image
python3 scripts/liblib_client.py img2video "the cat turns its head" --start-frame https://example.com/cat.jpg
# Check task status
python3 scripts/liblib_client.py status <generateUuid>
```
## 图像生成 (Seedream4.5)
- 端点:`POST /api/generate/seedreamV4`
- 模型:`doubao-seedream-4-5-251128`
- 默认尺寸:2048×2048。对于 4.5,最小总像素数 = 3,686,400(例如 2560×1440)
- 支持参考图像(1-14 张)、提示词扩展和顺序图像生成
- 选项:`--width`、`--height`、`--count`(1-15)、`--ref-images`、`--prompt-magic`
## 视频生成 (Kling)
### 文本转视频
- 端点:`POST /api/generate/video/kling/text2video`
- 模型:`kling-v2-6`(最新,支持声音)、`kling-v2-1-master`、`kling-v2-5-turbo` 等
- 选项:`--model`、`--aspect`(16:9/9:16/1:1)、`--duration`(5/10 秒)、`--mode`(std/pro)、`--sound`(on/off)
### 图像转视频
- 端点:`POST /api/generate/video/kling/img2video`
- 提供 `--start-frame` 图像 URL;可选 `--end-frame`(仅 v1-6)
- 对于 kling-v2-6:使用 `images` 数组而非 startFrame/endFrame
## 异步模式
所有生成任务都是异步的:
1. 提交任务 → 获取 `generateUuid`
2. 使用 `{ "generateUuid": "..." }` 轮询 `POST /api/generate/status`
3. 结果包含 `images[].imageUrl` 或 `videos[].videoUrl`
脚本默认自动轮询。使用 `--no-poll` 仅提交不轮询。
## 注意事项
- QPS 限制:任务提交为 1 请求/秒
- 最大并发任务数:5
- 结果中的图像 URL 在 7 天后过期
- 对于 kling-v2-5-turbo 和 kling-v2-6,mode 必须为 "pro"(默认)
- 声音生成仅在 kling-v2-6+ 上支持