关于 media-generation
通过 x402 付费端点生成和编辑图像、视频及 SVG 的 StableStudio 技能,提供多种模型与可配置输出选项,并支持异步任务轮询。
主要功能
- 01生成和编辑图像
- 02根据文本或图像生成视频
- 03将公开图像转换为 SVG
- 04选择多种生成模型
- 05轮询异步任务获取结果
适用场景
- 01按指定尺寸和质量创建图像
- 02根据提示词或图像输入生成视频
- 03使用提示词编辑源图像
- 04将公开图像 URL 矢量化
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ merit-systems/ agentcash-skills --skill media-generation安装后在 Claude Code 中输入/media-generation确认已加载。
附带文件rules/getting-started.mdrules/uploads.md
详细介绍
使用 StableStudio 生成媒体内容
通过 https://stablestudio.dev 使用 x402 付款生成图像和视频。
设置
如果尚未安装 agentcash CLI,请参阅 rules/getting-started.md,了解安装和钱包设置方法。
定价
所有生成端点都是动态定价的异步任务。静态价格显示一个范围(最高 $10;seedance 最高 $20)——确切价格取决于你的选项(质量、分辨率、时长),并会在付款前通过 x402 报价,因此 CLI 会显示每次请求的实际费用。已验证的报价示例:gpt-image-2 为 $0.21(默认设置)/ $0.01(低质量,1024x1024);flux-2-max 为 $0.07(默认设置);seedance t2v 为 $0.36(4s,480p)。
快速参考
图像模型
| 模型 | 端点 | 费用 | 耗时 | 支持编辑? |
|---|---|---|---|---|
| gpt-image-2(默认) | gpt-image-2/generate | 根据质量和尺寸为 $0.01-0.21 | 可能需要几分钟 | 是 |
| gpt-image-1.5 | gpt-image-1.5/generate | 动态 | ~3s | 是 |
| nano-banana-pro | nano-banana-pro/generate | 动态 | ~10s | 是 |
| nano-banana | nano-banana/generate | 动态 | ~5s | 是 |
| grok | grok/generate | 动态 | ~3s | 是 |
| flux-2-pro | flux-2-pro/generate | 动态 | ~5s | 是 |
| flux-2-max | flux-2-max/generate | 默认设置下约 $0.07 | — | 是 |
所有端点均以 https://stablestudio.dev/api/generate/ 为前缀。编辑端点使用 /edit,而非 /generate。
视频模型
| 模型 | 端点 | 费用 | 耗时 |
|---|---|---|---|
| veo-3.1(默认) | veo-3.1/generate | 动态 | 1-2min |
| veo-3.1-fast | veo-3.1-fast/generate | 动态 | ~30s |
| grok-video | grok-video/generate | 动态 | ~17s |
| seedance(Seedance 2 Pro) | seedance/t2v 或 seedance/i2v | 动态,最高 $20(4s/480p 为 $0.36) | ~1min |
| seedance-fast(Seedance 2 Fast) | seedance-fast/t2v 或 seedance-fast/i2v | 动态,最高 $20 | ~40s |
| wan-2.6 | wan-2.6/t2v 或 wan-2.6/i2v | 动态 | 2-5min |
| sora-2 | sora-2/generate | 动态 | 1-3min |
| sora-2-pro | sora-2-pro/generate | 动态 | 2-5min |
SVG 矢量化
| 模型 | 端点 | 费用 |
|---|---|---|
| arrow-1.1 | arrow-1.1/vectorize | 动态 |
| arrow-1.1-max | arrow-1.1-max/vectorize | 动态 |
图像生成
默认:gpt-image-2。 这是默认首选的图像模型。注意:生成可能需要几分钟——请轮询 jobId,不要重新提交尚未完成的任务。除非用户明确要求使用其他模型,或有充分理由(例如速度、预算或 grok 支持的超宽宽高比),否则请使用此模型。
npx agentcash@latest fetch https://stablestudio.dev/api/generate/gpt-image-2/generate -m POST -b '{
"prompt": "a cat wearing a space helmet, photorealistic",
"quality": "high",
"size": "1536x1024"
}'
gpt-image-2 选项:
quality:“low”、“medium”、“high”(影响费用:低质量约 $0.01,高质量约 $0.21)size:“1024x1024”、“1536x1024”、“1024x1536”、“auto”background:“opaque”、“auto”。output_format:“png”、“jpeg”、“webp”
其他图像模型
gpt-image-1.5 —— 速度最快的 GPT 图像模型。与 gpt-image-2 使用相同的架构;其 background 还支持 "transparent":
npx agentcash@latest fetch https://stablestudio.dev/api/generate/gpt-image-1.5/generate -m POST -b '{
"prompt": "a watercolor painting of a mountain lake",
"quality": "high",
"size": "1536x1024"
}'
选项:quality:"low"/"medium"/"high"。size:"1024x1024"、"1536x1024"、"1024x1536"、"auto"。
nano-banana-pro —— 高画质,最高支持 4K:
npx agentcash@latest fetch https://stablestudio.dev/api/generate/nano-banana-pro/generate -m POST -b '{
"prompt": "a cat wearing a space helmet, photorealistic",
"aspectRatio": "16:9",
"imageSize": "2K"
}'
选项:aspectRatio:"1:1"、"2:3"、"3:2"、"3:4"、"4:3"、"4:5"、"5:4"、"9:16"、"16:9"、"21:9"。imageSize:"1K"、"2K"、"4K"。
nano-banana —— 经济型选项。在 nano-banana-pro 支持的比例基础上增加了极端宽高比("1:4"、"4:1"、"1:8"、"8:1"),imageSize 还增加了 "512",并支持 thinkingLevel:"minimal"(速度最快)或 "high"(画质最佳)。
grok —— 速度快,支持多种宽高比。注意:使用 aspect_ratio(下划线):
npx agentcash@latest fetch https://stablestudio.dev/api/generate/grok/generate -m POST -b '{
"prompt": "neon cyberpunk cityscape at night",
"aspect_ratio": "16:9"
}'
选项:aspect_ratio:"1:1"、"16:9"、"9:16"、"4:3"、"3:4"、"3:2"、"2:3"、"2:1"、"1:2"、"19.5:9"、"9:19.5"、"20:9"、"9:20"。
flux-2-pro —— 高画质,支持分辨率控制:
npx agentcash@latest fetch https://stablestudio.dev/api/generate/flux-2-pro/generate -m POST -b '{
"prompt": "editorial photo of a vintage car in golden hour light",
"aspect_ratio": "3:2",
"resolution": "2 MP"
}'
选项:aspect_ratio:"1:1"、"16:9"、"9:16"、"3:2"、"2:3"、"4:5"、"5:4"、"4:3"、"3:4"。resolution:"0.5 MP"、"1 MP"、"2 MP"。
flux-2-max —— 与 flux-2-pro 使用相同的架构,画质更高;resolution 还支持 "4 MP"。
SVG 矢量化
使用 arrow-1.1(或使用 arrow-1.1-max 获得更高画质)将任意公开图像 URL 转换为 SVG:
npx agentcash@latest fetch https://stablestudio.dev/api/generate/arrow-1.1/vectorize -m POST -b '{
"image": "https://example.com/logo.png"
}'
可选参数:target_size(以像素为单位的正方形缩放目标,128-4096,默认值为 1024)、auto_crop(裁剪至主体,默认值为 false)。轮询返回的 jobId 以获取 SVG 结果。
视频生成
推荐:veo-3.1(画质最佳)
npx agentcash@latest fetch https://stablestudio.dev/api/generate/veo-3.1/generate -m POST -b '{
"prompt": "a timelapse of clouds moving over mountains",
"durationSeconds": "6",
"aspectRatio": "16:9"
}'
veo-3.1 选项:
durationSeconds:"4"、"6"、"8"aspectRatio:"16:9"、"9:16"resolution:"720p"、"1080p"negativePrompt:需要避免的内容
veo-3.1 还支持通过 imageMode("none"、"first-frame"、"reference"、"interpolation")使用图像输入:在 image 和 lastFrame blob URL 之间进行帧插值,或使用最多 3 张 referenceImages 进行风格引导。
veo-3.1-fast —— 与 veo-3.1 使用相同的架构,价格更低,耗时约 30 秒,而非 1-2 分钟。
其他视频模型
seedance(Seedance 2 Pro)—— 高画质,最长支持 15 秒。使用 seedance/t2v(文生视频)或 seedance/i2v(图生视频):
npx agentcash@latest fetch https://stablestudio.dev/api/generate/seedance/t2v -m POST -b '{
"prompt": "a bird taking flight from a branch in slow motion",
"duration": "8",
"aspectRatio": "16:9",
"outputResolution": "1080p"
}'
必填项:prompt、duration、aspectRatio、outputResolution。选项:duration:"4"-"15"。aspectRatio(驼峰命名):"1:1"、"3:4"、"4:3"、"16:9"、"9:16"、"21:9"。outputResolution:"480p"、"720p"、"1080p"。可选参数 upscaleResolution:"4k"。对于 i2v,添加 "image": "https://blob-url..."。不接受未知字段。
seedance-fast(Seedance 2 Fast)—— 使用相同的架构,价格更低、速度更快;outputResolution 最高为 "720p"。
grok-video —— 最便宜的短视频选项:
npx agentcash@latest fetch https://stablestudio.dev/api/generate/grok-video/generate -m POST -b '{
"prompt": "a candle flame flickering",
"duration": "6",
"resolution": "720p",
"aspect_ratio": "16:9"
}'
选项:duration:"3"、"6"、"9"、"12"、"15"。resolution:"480p"、"720p"。aspect_ratio:"1:1"、"16:9"、"9:16"、"4:3"、"3:4"、"3:2"、"2:3"。可选参数 image 为图生视频提供图像 URL。
wan-2.6 —— 经济型,支持 t2v 和 i2v。duration:"5"、"10"、"15"。t2v 使用 size("1280720"、"7201280"、"19201080"、"10801920");i2v 使用 resolution("720p"、"1080p")和 image。
sora-2 —— seconds:"4"、"8"、"12"。size:"1280x720"、"720x1280"。可选参数 input_reference 为图生视频提供图像 URL。
sora-2-pro —— 高级版。seconds 与 sora-2 相同("4"、"8"、"12");size 还增加了 "1792x1024"、"1024x1792"。
任务轮询
生成任务会返回 jobId 和 pollUrl。持续轮询直到任务完成:
npx agentcash@latest fetch https://stablestudio.dev/api/jobs/{jobId}
图像每 3 秒轮询一次,视频每 10 秒轮询一次。结果包含 imageUrl 或 videoUrl(矢量化任务的 SVG 内容)。
fetch 同时处理付费提交请求和免费的 SIWX 轮询请求。
其他任务端点(SIWX,免费):GET /api/jobs 列出你的所有任务;DELETE /api/jobs/{jobId} 软删除失败的任务。
图像编辑
需要先上传源图像。请参阅 rules/uploads.md。
所有图像模型都支持 /edit。编辑端点接受 images(Blob URL 数组)和 prompt。
npx agentcash@latest fetch https://stablestudio.dev/api/generate/gpt-image-2/edit -m POST -b '{
"prompt": "change the background to a beach sunset",
"images": ["https://...blob-url..."]
}'
Grok 编辑还支持 aspect_ratio。GPT-image 编辑使用与生成相同的 quality/size 选项。
模型对比
图像模型
| 模型 | 费用 | 速度 | 最适合 |
|---|---|---|---|
| gpt-image-2 | $0.01-0.21 | 几分钟 | 默认首选;轮询,不要重新提交 |
| gpt-image-1.5 | 动态 | ~3s | 快速生成 GPT 图像、透明背景 |
| nano-banana-pro | 动态 | ~10s | 高质量,最高 4K 分辨率 |
| nano-banana | 动态 | ~5s | 快速草稿、极端宽高比 |
| grok | 动态 | ~3s | 速度快,支持多种宽高比 |
| flux-2-pro | 动态 | ~5s | 高质量,可控制分辨率 |
| flux-2-max | ~$0.07+ | — | Flux 顶级画质,最高 4 MP |
视频模型
| 模型 | 费用 | 速度 | 最适合 |
|---|---|---|---|
| veo-3.1 | 动态 | 1-2min | 最佳画质、插帧、参考素材 |
| veo-3.1-fast | 动态 | ~30s | 快速生成高质量视频 |
| grok-video | 动态 | ~17s | 最便宜的短视频 |
| seedance | 最高 $20 | ~1min | 高质量,最长 15s,可升频至 4K |
| seedance-fast | 最高 $20 | ~40s | 价格实惠、画质不错的视频 |
| wan-2.6 | 动态 | 2-5min | 价格实惠,支持文本或图像输入、音频同步 |
| sora-2 | 动态 | 1-3min | 优质画质 |
| sora-2-pro | 动态 | 2-5min | 最高画质 |