Install
openclaw skills install jimeng-ai基于火山引擎即梦AI的文生图/文生视频能力,支持通过文本描述生成图片和视频。
openclaw skills install jimeng-ai基于火山引擎即梦AI的文生图和文生视频能力,支持通过文本描述生成图片和视频。
| 变量名 | 是否必需 | 说明 |
|---|---|---|
VOLCENGINE_AK | 必需 | 火山引擎 Access Key |
VOLCENGINE_SK | 条件必需 | 火山引擎 Secret Key(永久凭证必需) |
VOLCENGINE_TOKEN | 可选 | 安全令牌(临时凭证 STS 必需) |
注意:使用临时凭证(AKTP 开头)时,可以只使用 AK + Token,不需要 SK。
export VOLCENGINE_AK="your-access-key"
export VOLCENGINE_SK="your-secret-key"
# 如果使用临时凭证(STS),还需要设置 Token
export VOLCENGINE_TOKEN="your-security-token"
获取方式:
cd ~/.openclaw/workspace/skills/jimeng-ai
npm install
使用新提示词运行时,脚本将:
md5(提示词) 作为文件夹名创建目录param.json、response.json 和 taskId.txt"任务已提交,TaskId: xxx"$ npx ts-node scripts/text2image.ts "一只可爱的猫咪"
任务已提交,TaskId: 1234567890
使用相同提示词运行将查询已有任务:
"任务未完成,TaskId: xxx"binary_data_base64 解码并保存图片$ npx ts-node scripts/text2image.ts "一只可爱的猫咪"
任务未完成,TaskId: 1234567890
# 或者任务完成时:
$ npx ts-node scripts/text2image.ts "一只可爱的猫咪"
任务已完成,图片保存路径:
- ./output/<md5_hash>/1.jpg
- ./output/<md5_hash>/2.jpg
npx ts-node scripts/text2image.ts "一只可爱的猫咪"
npx ts-node scripts/text2image.ts "提示词" \
--version v40 \
--ratio 16:9 \
--count 2
| 参数 | 说明 | 默认值 |
|---|---|---|
prompt | 图片生成提示词(必填) | - |
--version | API版本: v30, v31, v40 | v31 |
--ratio | 宽高比: 1:1, 9:16, 16:9, 3:4, 4:3, 2:3, 3:2, 1:2, 2:1 | 16:9 |
--count | 生成数量 1-4 | 1 |
--width | 指定宽度(可选) | - |
--height | 指定高度(可选) | - |
--size | 指定面积(可选,如 4194304 表示 2048x2048) | - |
--seed | 随机种子(可选) | - |
--output | 图片输出目录 | ./output |
--debug | 调试模式 | false |
--no-download | 不下载图片,只返回URL | false |
{
"success": true,
"submitted": true,
"prompt": "一只可爱的猫咪",
"version": "v40",
"ratio": "1:1",
"count": 1,
"taskId": "1234567890",
"folder": "./output/<md5_hash>",
"message": "任务已提交,请稍后使用相同提示词查询结果"
}
{
"success": true,
"prompt": "一只可爱的猫咪",
"version": "v40",
"ratio": "1:1",
"count": 1,
"taskId": "1234567890",
"images": [
"./output/<md5_hash>/1.jpg",
"./output/<md5_hash>/2.jpg"
],
"outputDir": "./output/<md5_hash>"
}
{
"success": true,
"prompt": "一只可爱的猫咪",
"version": "v40",
"ratio": "1:1",
"count": 1,
"taskId": "1234567890",
"folder": "./output/<md5_hash>",
"message": "任务未完成,请稍后使用相同提示词查询结果"
}
{
"success": false,
"error": {
"code": "MISSING_CREDENTIALS",
"message": "请设置环境变量 VOLCENGINE_AK 和 VOLCENGINE_SK"
}
}
output/
└── <md5(prompt)>/ # md5哈希作为文件夹名
├── param.json # 请求参数
├── response.json # API提交响应
├── taskId.txt # 任务ID
└── 1.jpg, 2.jpg, ... # 生成的图片
npx ts-node scripts/text2image.ts "山水风景画,水墨风格" --version v40 --ratio 16:9
npx ts-node scripts/text2image.ts "未来科幻城市,霓虹灯光,赛博朋克风格" --version v40 --ratio 16:9 --count 2
npx ts-node scripts/text2image.ts "抽象艺术" --width 2048 --height 1152
npx ts-node scripts/text2image.ts "一只可爱的猫咪" --output ~/Pictures/jimeng
npx ts-node scripts/text2video.ts "一只可爱的猫咪在草地上奔跑"
npx ts-node scripts/text2video.ts "提示词" \
--ratio 9:16 \
--duration 5 \
--fps 24
| 参数 | 说明 | 默认值 |
|---|---|---|
prompt | 视频生成提示词(必填) | - |
--ratio | 宽高比: 16:9, 4:3, 1:1, 3:4, 9:16, 21:9 | 9:16 |
--duration | 视频时长: 5 或 10 秒 | 5 |
--fps | 帧率: 24 或 30 | 24 |
--output | 视频输出目录 | ./output |
--wait | 等待任务完成 | false |
--debug | 调试模式 | false |
--no-download | 不下载视频,只返回URL | false |
{
"success": true,
"submitted": true,
"prompt": "元宵节灯笼",
"ratio": "9:16",
"duration": 5,
"fps": 24,
"taskId": "1234567890",
"folder": "./output/video/<md5_hash>",
"message": "任务已提交,请稍后使用相同提示词查询结果"
}
{
"success": true,
"prompt": "元宵节灯笼",
"ratio": "9:16",
"duration": 5,
"fps": 24,
"taskId": "1234567890",
"videoUrl": "https://...",
"data": {}
}
{
"success": true,
"pending": true,
"prompt": "元宵节灯笼",
"ratio": "9:16",
"duration": 5,
"fps": 24,
"taskId": "1234567890",
"status": "in_queue",
"message": "任务处理中,请稍后使用相同提示词查询结果"
}
output/video/
└── <md5(prompt)>/ # md5哈希作为文件夹名
├── param.json # 请求参数
├── response.json # API提交响应
├── taskId.txt # 任务ID
└── video.mp4 # 生成的视频