Ultimate AI Media Generator Skill
Overview
A powerful skill for generating AI images and videos using the world's leading generative models:
- - Sora 2 — OpenAI's flagship video generation model
- Kling 2.6 — High-quality video generation with image-to-video support
- Seedance 2.0 — ByteDance's advanced video model
- Nano Banana Pro — Fast, cost-effective image generation
- Veo 3.1 — Google's state-of-the-art video model
- And more...
Supports all major generation workflows: text-to-image, text-to-video, image-to-image, image-to-video, and video-to-video. The skill handles credit estimation, task creation, status polling, and automatic media output saving.
Built-in Prompt Optimization
This skill automatically optimizes prompts for specific use cases to achieve the best results:
- - SEO Articles — Generate featured images and illustrations optimized for blog posts and articles
- Presentations/Slides — Create professional visuals for PowerPoint, Keynote, and Google Slides
- Anime/Manga — Generate anime-style artwork with optimized prompts for consistent style
- Product Photography — Create product shots with proper lighting and composition
- Social Media — Generate platform-optimized visuals for Instagram, TikTok, YouTube
- Marketing Materials — Create ad creatives, banners, and promotional content
The included workflow templates (workflows/ folder) provide ready-to-use prompts and best practices for each use case.
Implementation Architecture
The runtime uses a layered Python architecture:
- -
scripts/cyberbara_api.py: thin entrypoint only - INLINECODE2 : command parsing and command routing
- INLINECODE3 : flow orchestration (generation + polling)
- INLINECODE4 : safety and policy rules (credits quote + formal confirmation)
- INLINECODE5 : raw CyberBara API client
- INLINECODE6 : API key discovery and local persistence
- INLINECODE7 : fixed base URL and shared constants
When extending behavior, keep business rules in usecases/ or policies/, not in scripts/.
Set Up Runtime Inputs
The script uses fixed base URL:
CODEBLOCK0
API key lookup order:
- 1. INLINECODE11
- environment variable INLINECODE12
- local cache file INLINECODE13
- interactive prompt (if running in terminal)
Recommended one-time setup command:
CODEBLOCK1
Or save from environment variable:
CODEBLOCK2
If API key is missing, the script immediately asks for it and shows where to get one:
CODEBLOCK3
When you provide API key via --api-key or interactive prompt, it is saved to:
CODEBLOCK4
Future runs reuse this cached key, so users do not need to provide it every time.
Run The Standard Generation Flow
- 1. Discover available models.
- Upload reference images when task scene needs image inputs.
- Quote credits before creating a generation task.
- Create image or video generation task and wait for final output.
- Automatically save generated media locally and open it.
- Check usage records when needed.
Reference commands:
CODEBLOCK5
Image and video generation are confirmation-gated by default:
CODEBLOCK6
INLINECODE15 format:
CODEBLOCK7
Only use --yes after explicit user approval has been obtained:
CODEBLOCK8
Control auto-save and open behavior:
CODEBLOCK9
Use Script Capabilities
INLINECODE17 supports:
- -
setup-api-key to persist API key into local cache - INLINECODE19 to list public models (
--media-type image|video optional) - INLINECODE21 to upload local image files to INLINECODE22
- INLINECODE23 to estimate credit cost from JSON request body
- INLINECODE24 to auto-quote credits, compute total for batch requests, require formal confirmation, create task(s), wait, then save/open outputs
- INLINECODE25 to auto-quote credits, compute total for batch requests, require formal confirmation, create task(s), wait, then save/open outputs
- INLINECODE26 to fetch task snapshot by task ID
- INLINECODE27 to poll task until
success, failed, or canceled, then save/open outputs - INLINECODE31 and
usage to inspect credits - INLINECODE33 for direct custom endpoint calls
Use --file request.json instead of --json for long payloads.
Enforce API Payload Rules
- - Send auth via API key (
Authorization: Bearer <key> or x-api-key). - Send public request fields under
options.* only. - Prefer explicit
scene to avoid inference ambiguity. - Include
options.image_input for image-to-image and image-to-video. - Include
options.video_input for video-to-video. - Poll
/api/v1/tasks/{taskId} until final status; only success guarantees output URLs. - Before every image or video generation submission, obtain quote first and get explicit user confirmation.
- For multiple image/video requests, calculate and present total estimated credits before submission.
- Save output files under
media_outputs/ by default and auto-open them unless disabled.
Navigate Detailed Model Options
Use the reference file for full model matrices and examples:
For fast lookup in large reference:
CODEBLOCK10
Handle Common Failures
- -
invalid_api_key or api_key_required: verify key and headers. - INLINECODE51 : quote first or recharge credits.
- INLINECODE52 or
scene_not_supported: choose scene supported by model. - INLINECODE54 : verify
prompt and options requirements by model. - INLINECODE57 : verify task ID and environment domain.
终极AI媒体生成技能
概述
一项使用世界领先生成模型生成AI图像和视频的强大技能:
- - Sora 2 — OpenAI旗舰视频生成模型
- Kling 2.6 — 高质量视频生成,支持图像转视频
- Seedance 2.0 — 字节跳动先进视频模型
- Nano Banana Pro — 快速、经济高效的图像生成
- Veo 3.1 — 谷歌最先进的视频模型
- 以及更多...
支持所有主要生成工作流:文本转图像、文本转视频、图像转图像、图像转视频和视频转视频。该技能处理积分估算、任务创建、状态轮询和自动媒体输出保存。
内置提示词优化
此技能自动针对特定用例优化提示词,以获得最佳效果:
- - SEO文章 — 生成针对博客文章优化的特色图片和插图
- 演示文稿/幻灯片 — 为PowerPoint、Keynote和Google Slides创建专业视觉效果
- 动漫/漫画 — 生成动漫风格艺术作品,提示词优化以保持风格一致
- 产品摄影 — 创建具有适当照明和构图的产品照片
- 社交媒体 — 为Instagram、TikTok、YouTube生成平台优化的视觉效果
- 营销材料 — 创建广告创意、横幅和促销内容
包含的工作流模板(workflows/文件夹)为每个用例提供即用型提示词和最佳实践。
实现架构
运行时使用分层Python架构:
- - scripts/cyberbaraapi.py:精简入口点
- src/cyberbaracli/cli.py:命令解析和命令路由
- src/cyberbaracli/usecases/:流程编排(生成+轮询)
- src/cyberbaracli/policies/:安全和策略规则(积分报价+正式确认)
- src/cyberbaracli/gateways/:原始CyberBara API客户端
- src/cyberbaracli/config.py:API密钥发现和本地持久化
- src/cyberbara_cli/constants.py:固定基础URL和共享常量
扩展行为时,将业务规则保留在usecases/或policies/中,而不是scripts/中。
设置运行时输入
脚本使用固定基础URL:
text
https://cyberbara.com
API密钥查找顺序:
- 1. --api-key
- 环境变量CYBERBARAAPIKEY
- 本地缓存文件~/.config/cyberbara/api_key
- 交互式提示(如果在终端中运行)
推荐的一次性设置命令:
bash
python3 scripts/cyberbara_api.py setup-api-key
或从环境变量保存:
bash
export CYBERBARAAPIKEY=
python3 scripts/cyberbara_api.py setup-api-key --from-env
如果缺少API密钥,脚本会立即询问并显示获取位置:
text
https://cyberbara.com/settings/apikeys
当您通过--api-key或交互式提示提供API密钥时,它会被保存到:
text
~/.config/cyberbara/api_key
后续运行会重用此缓存密钥,因此用户无需每次都提供。
运行标准生成流程
- 1. 发现可用模型。
- 当任务场景需要图像输入时上传参考图像。
- 在创建生成任务前报价积分。
- 创建图像或视频生成任务并等待最终输出。
- 自动在本地保存生成的媒体并打开。
- 需要时检查使用记录。
参考命令:
bash
1) 列出视频模型
python3 scripts/cyberbara_api.py models --media-type video
2) 上传本地参考图像
python3 scripts/cyberbara_api.py upload-images ./frame.png ./style.jpg
3) 估算积分
python3 scripts/cyberbara_api.py quote --json {
model:sora-2,
media_type:video,
scene:text-to-video,
options:{duration:10}
}
4) 创建视频任务(默认行为:等待成功,保存输出到./media_outputs,自动打开)
python3 scripts/cyberbara_api.py generate-video --json {
model:sora-2,
prompt:日出时雪山上空的平静无人机镜头,
scene:text-to-video,
options:{duration:10,resolution:standard}
}
5) 现有任务:等待+保存/打开输出
python3 scripts/cyberbara
api.py wait --task-id ID> --interval 5 --timeout 900
图像和视频生成默认需要确认:
bash
单图像请求:脚本自动报价,然后要求您输入CONFIRM
python3 scripts/cyberbara_api.py generate-image --json {
model:nano-banana-pro,
prompt:霓虹雨下的电影级肖像,
scene:text-to-image,
options:{resolution:1k}
}
批量图像请求(JSON数组):脚本自动为每个请求报价并打印总估算积分
python3 scripts/cyberbara_api.py generate-image --file ./image-requests.json
image-requests.json格式:
json
[
{
model: nano-banana-pro,
prompt: 霓虹雨下的电影级肖像,
scene: text-to-image,
options: { resolution: 1k }
},
{
model: nano-banana-pro,
prompt: 具有戏剧性侧光的产品静物,
scene: text-to-image,
options: { resolution: 1k }
}
]
仅在获得用户明确批准后使用--yes:
bash
python3 scripts/cyberbara_api.py generate-image --file ./image-requests.json --yes
python3 scripts/cyberbara_api.py generate-video --json {
model:sora-2,
prompt:日出时雪山上空的平静无人机镜头,
scene:text-to-video,
options:{duration:10,resolution:standard}
} --yes
控制自动保存和打开行为:
bash
继续等待但不自动打开媒体
python3 scripts/cyberbara_api.py generate-image --file ./image-requests.json --yes --no-open
自定义输出目录
python3 scripts/cyberbara_api.py generate-video --json {...} --yes --output-dir ./downloads
仅提交(不等待/保存/打开)
python3 scripts/cyberbara_api.py generate-video --json {...} --yes --async
使用脚本功能
scripts/cyberbara_api.py支持:
- - setup-api-key 将API密钥持久化到本地缓存
- models 列出公共模型(--media-type image|video可选)
- upload-images 将本地图像文件上传到/api/v1/uploads/images
- quote 从JSON请求体估算积分成本
- generate-image 自动报价积分,计算批量请求总数,要求正式确认,创建任务,等待,然后保存/打开输出
- generate-video 自动报价积分,计算批量请求总数,要求正式确认,创建任务,等待,然后保存/打开输出
- task 按任务ID获取任务快照
- wait 轮询任务直到success、failed或canceled,然后保存/打开输出
- balance和usage 检查积分
- raw 用于直接自定义端点调用
对于长负载使用--file request.json而不是--json。
执行API负载规则
- - 通过API密钥发送认证(Authorization: Bearer 或x-api-key)。
- 仅在options.*下发送公共请求字段。
- 优先使用明确的scene以避免推理歧义。
- 对于image-to-image和image-to-video包含options.imageinput。
- 对于video-to-video包含options.video
input。
轮询/api/v1/tasks/{taskId}直到最终状态;只有success保证输出URL。在每次图像或视频生成提交前,先获取报价并获得用户明确确认。对于多个图像/视频请求,在提交前计算并显示总估算积分。默认将输出文件保存到media_outputs/下,除非禁用,否则自动打开。
导航详细模型选项
使用参考文件获取完整模型矩阵和示例:
- - references/cyberbara-api-reference.mdx
在大型参考中快速查找:
bash
rg ^## |^### references/cyberbara-api-reference.mdx