mcpField
M
media-generation

media-generation

github.com/merit-systems创意与媒体23139 次安装10 周前更新
代码仓库

关于 media-generation

通过 x402 付费端点生成和编辑图像、视频及 SVG 的 StableStudio 技能,提供多种模型与可配置输出选项,并支持异步任务轮询。

主要功能

  1. 01生成和编辑图像
  2. 02根据文本或图像生成视频
  3. 03将公开图像转换为 SVG
  4. 04选择多种生成模型
  5. 05轮询异步任务获取结果

适用场景

  1. 01按指定尺寸和质量创建图像
  2. 02根据提示词或图像输入生成视频
  3. 03使用提示词编辑源图像
  4. 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.5gpt-image-1.5/generate动态~3s是
nano-banana-pronano-banana-pro/generate动态~10s是
nano-banananano-banana/generate动态~5s是
grokgrok/generate动态~3s是
flux-2-proflux-2-pro/generate动态~5s是
flux-2-maxflux-2-max/generate默认设置下约 $0.07—是

所有端点均以 https://stablestudio.dev/api/generate/ 为前缀。编辑端点使用 /edit,而非 /generate。

视频模型
模型端点费用耗时
veo-3.1(默认)veo-3.1/generate动态1-2min
veo-3.1-fastveo-3.1-fast/generate动态~30s
grok-videogrok-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.6wan-2.6/t2v 或 wan-2.6/i2v动态2-5min
sora-2sora-2/generate动态1-3min
sora-2-prosora-2-pro/generate动态2-5min
SVG 矢量化
模型端点费用
arrow-1.1arrow-1.1/vectorize动态
arrow-1.1-maxarrow-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最高画质

评论

支持 Markdown