Docs · guides

Media Generation Tool

Generate images and videos with AI using the MediaGeneration MCP tool. Supports Flux 2, Grok (xAI), Kling, Wan, Alibaba Cloud (Qwen/Wan), and ByteDance ModelArk (Seedream/Seedance) models.

Media Generation Tool

The MediaGeneration tool lets your agents generate images and videos directly in conversations. It's available as a built-in MCP tool at mcp__teamday-media__MediaGeneration.

Credits are automatically checked before generation and deducted after success --- you don't need to manage billing manually.


Actions

ActionPurpose
generateImageText-to-image generation
generateAvatarSquare profile image (1:1)
imageToVideoAnimate a static image into a video clip
checkBalanceCheck credit balance before generating

Image Generation

Basic Usage

Generate a blog cover image of a futuristic AI workspace with soft neon lighting.

The agent calls:

{
  "action": "generateImage",
  "prompt": "Futuristic AI workspace with soft neon lighting, clean modern design",
  "outputPath": "images/ai-workspace.png"
}

Parameters

ParameterTypeDefaultDescription
promptstringrequiredText description of the image to generate
modelstringflux-2-flexImage model to use (see Models below)
aspectRatioenumlandscape_16_9Aspect ratio for the image
outputPathstringgenerated-image.pngFile path relative to workspace

Aspect Ratios

ValueUse Case
landscape_16_9Blog covers, headers
landscape_4_3Standard landscape
squareSocial media, thumbnails
portrait_9_16Mobile, stories
portrait_4_5Instagram, portraits

Image Models

ModelProviderCostBest For
flux-2-flexFAL.AI4cGeneral purpose, prompt expansion (safe default)
grok-imagine-imagexAI3cFast, affordable creative images
grok-imagine-image-proxAI11cHigher quality output
gpt-image-1OpenAI6cPhotorealism, reliable text rendering (medium quality)
gpt-image-1-hdOpenAI22cOpenAI high-quality tier — use when text clarity or fine detail matters
qwen-image-2.0Alibaba Cloud3.5cVersatile image generation via DashScope
qwen-image-2.0-proAlibaba Cloud7.5cHigher quality Qwen images
wan2.7-image-proAlibaba Cloud7.5cWan 2.7 pro-quality images
seedreamByteDance ModelArk5cSeedream image generation

Avatar Generation

A convenience action that forces square aspect ratio --- ideal for profile pictures.

{
  "action": "generateAvatar",
  "prompt": "Professional headshot, friendly smile, neutral background",
  "outputPath": "avatar.png"
}

Video Generation

Image-to-Video

Animate a static image into a short video clip. Requires either imagePath (local file in workspace) or imageUrl (public URL).

{
  "action": "imageToVideo",
  "imagePath": "images/product-shot.png",
  "prompt": "Subtle zoom in with gentle particle effects",
  "videoModel": "kling",
  "duration": 5,
  "outputPath": "videos/product-animation.mp4"
}

Parameters

ParameterTypeDefaultDescription
imagePathstring---Path to source image in workspace
imageUrlstring---Public URL of source image (alternative to imagePath)
promptstring""Motion/style description
videoModelstringklingVideo model: kling, wan, or grok
durationnumber5Duration in seconds (5 or 10)
outputPathstringgenerated-video.mp4Output file path

Video Models

ModelProvider5s Cost10s CostNotes
klingFAL.AI53c$1.05Premium quality, best motion
wanFAL.AI30c---Fast generation
grokxAI38c75cRequires imageUrl (public URL)
wan2.7-i2vAlibaba Cloud~50c~100cWan 2.7 image-to-video (~10c/sec)
happyhorse-1.0-i2vAlibaba Cloud~56c~112cHappyHorse image-to-video (~11.2c/sec)
seedanceByteDance ModelArk10c20cSeedance image-to-video

Note: Grok video generation requires a public image URL (imageUrl), not a local file path. Upload the image first or provide an existing URL.

Note: Alibaba Cloud models (wan2.7-i2v, happyhorse-1.0-i2v) and ByteDance ModelArk models (seedance) require the corresponding provider credentials configured on your workspace. Contact your workspace admin to enable these providers.


Checking Balance

Before generating expensive media, check if the user has enough credits:

{
  "action": "checkBalance",
  "estimateAction": "video",
  "videoModel": "kling",
  "duration": 10
}

Returns:

{
  "sufficient": true,
  "balanceCents": 1250,
  "estimatedCostCents": 105,
  "balanceFormatted": "$12.50",
  "costFormatted": "$1.05"
}

How It Works

  1. Agent calls the tool --- the MCP server runs inside the computer service
  2. Balance pre-check --- verifies the organization has enough credits
  3. API call --- sends the request to the provider (FAL.AI, xAI, OpenAI, Alibaba Cloud, or ByteDance ModelArk) depending on the model
  4. File saved --- downloads the result and saves it to the workspace
  5. Credits deducted --- only on successful generation

All generated files are saved to the agent's workspace (space directory). The agent can then reference them in responses, embed them in documents, or use them as inputs for further processing.


Tips for Agents

  • Always specify outputPath with a meaningful filename
  • Use checkBalance before expensive video generation
  • For blog images, use landscape_16_9 aspect ratio
  • For profile pictures, use generateAvatar (not generateImage with square)
  • Grok models are the most affordable option for images (3c vs 4c for Flux)
  • Kling produces the best video quality but costs more

Pricing Summary

All costs are per generation in USD cents.

Images:

ModelProviderCost per Image
grok-imagine-imagexAI3c
qwen-image-2.0Alibaba Cloud3c
flux-2-flexFAL.AI4c
gpt-image-1OpenAI6c
qwen-image-2.0-proAlibaba Cloud8c
wan2.7-image-proAlibaba Cloud8c
seedreamByteDance ModelArk5c
grok-imagine-image-proxAI11c
gpt-image-1-hdOpenAI22c

Videos:

Model + DurationProviderCost
seedance 5sByteDance ModelArk10c
seedance 10sByteDance ModelArk20c
wan 5sFAL.AI30c
grok 5sxAI38c
wan2.7-i2v per secAlibaba Cloud~10c/s
happyhorse-1.0-i2v per secAlibaba Cloud~11.2c/s
kling 5sFAL.AI53c
grok 10sxAI75c
kling 10sFAL.AI$1.05