agent-media
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgent Media
Agent Media
Agent Media is an agent-first media toolkit that provides CLI-accessible commands for image, video, and audio processing. All commands produce deterministic, machine-readable JSON output.
Agent Media是一款面向Agent的媒体工具包,提供可通过CLI调用的图片、视频和音频处理命令。所有命令均输出确定性、机器可读的JSON格式结果。
Available Commands
可用命令
Image Commands
图片命令
- - Resize an image
agent-media image resize - - Convert image format
agent-media image convert - - Remove image background
agent-media image remove-background - - Generate image from text
agent-media image generate
- - 调整图片尺寸
agent-media image resize - - 转换图片格式
agent-media image convert - - 移除图片背景
agent-media image remove-background - - 基于文本生成图片
agent-media image generate
Audio Commands
音频命令
- - Extract audio from video
agent-media audio extract - - Transcribe audio to text
agent-media audio transcribe
- - 从视频中提取音频
agent-media audio extract - - 将音频转写为文本
agent-media audio transcribe
Video Commands
视频命令
- - Generate video from text or image
agent-media video generate
- - 基于文本或图片生成视频
agent-media video generate
Output Format
输出格式
All commands return JSON to stdout:
json
{
"ok": true,
"media_type": "image",
"action": "resize",
"provider": "local",
"output_path": "output_123.webp",
"mime": "image/webp",
"bytes": 12345
}On error:
json
{
"ok": false,
"error": {
"code": "INVALID_INPUT",
"message": "input file not found"
}
}所有命令均向标准输出(stdout)返回JSON:
json
{
"ok": true,
"media_type": "image",
"action": "resize",
"provider": "local",
"output_path": "output_123.webp",
"mime": "image/webp",
"bytes": 12345
}错误时返回:
json
{
"ok": false,
"error": {
"code": "INVALID_INPUT",
"message": "input file not found"
}
}Providers
服务提供商
- local - Default provider using Sharp (resize, convert) and Transformers.js (remove-background, transcribe)
- fal - fal.ai provider (generate, edit, remove-background, transcribe, video)
- replicate - Replicate API (generate, edit, remove-background, transcribe, video)
- runpod - Runpod API (generate, edit)
- ai-gateway - Vercel AI Gateway (generate, edit)
- local - 默认提供商,使用Sharp(调整尺寸、格式转换)和Transformers.js(移除背景、语音转写)
- fal - fal.ai提供商(生成、编辑、移除背景、语音转写、视频处理)
- replicate - Replicate API(生成、编辑、移除背景、语音转写、视频处理)
- runpod - Runpod API(生成、编辑)
- ai-gateway - Vercel AI Gateway(生成、编辑)
Provider Selection
提供商选择
- Explicit:
--provider <name> - Auto-detect from environment variables
- Fallback to local provider
- 显式指定:
--provider <name> - 通过环境变量自动检测
- 回退至local提供商
Environment Variables
环境变量
- - Custom output directory
AGENT_MEDIA_DIR - - Enable fal provider
FAL_API_KEY - - Enable replicate provider
REPLICATE_API_TOKEN - - Enable runpod provider
RUNPOD_API_KEY - - Enable ai-gateway provider
AI_GATEWAY_API_KEY
- - 自定义输出目录
AGENT_MEDIA_DIR - - 启用fal提供商
FAL_API_KEY - - 启用replicate提供商
REPLICATE_API_TOKEN - - 启用runpod提供商
RUNPOD_API_KEY - - 启用ai-gateway提供商
AI_GATEWAY_API_KEY