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
grok-imagine-imagexAI3cFast, affordable creative images
grok-imagine-image-proxAI11cHigher quality output
grok-2-image-1212xAI11cAlternative xAI model

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)

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


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 FAL.AI or xAI 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:

ModelCost per Image
grok-imagine-image3c
flux-2-flex4c
grok-imagine-image-pro11c
grok-2-image-121211c

Videos:

Model + DurationCost
wan 5s30c
grok 5s38c
kling 5s53c
grok 10s75c
kling 10s$1.05