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
| Action | Purpose |
|---|---|
generateImage | Text-to-image generation |
generateAvatar | Square profile image (1:1) |
imageToVideo | Animate a static image into a video clip |
checkBalance | Check 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
| Parameter | Type | Default | Description |
|---|---|---|---|
prompt | string | required | Text description of the image to generate |
model | string | flux-2-flex | Image model to use (see Models below) |
aspectRatio | enum | landscape_16_9 | Aspect ratio for the image |
outputPath | string | generated-image.png | File path relative to workspace |
Aspect Ratios
| Value | Use Case |
|---|---|
landscape_16_9 | Blog covers, headers |
landscape_4_3 | Standard landscape |
square | Social media, thumbnails |
portrait_9_16 | Mobile, stories |
portrait_4_5 | Instagram, portraits |
Image Models
| Model | Provider | Cost | Best For |
|---|---|---|---|
flux-2-flex | FAL.AI | 4c | General purpose, prompt expansion |
grok-imagine-image | xAI | 3c | Fast, affordable creative images |
grok-imagine-image-pro | xAI | 11c | Higher quality output |
grok-2-image-1212 | xAI | 11c | Alternative 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
| Parameter | Type | Default | Description |
|---|---|---|---|
imagePath | string | --- | Path to source image in workspace |
imageUrl | string | --- | Public URL of source image (alternative to imagePath) |
prompt | string | "" | Motion/style description |
videoModel | string | kling | Video model: kling, wan, or grok |
duration | number | 5 | Duration in seconds (5 or 10) |
outputPath | string | generated-video.mp4 | Output file path |
Video Models
| Model | Provider | 5s Cost | 10s Cost | Notes |
|---|---|---|---|---|
kling | FAL.AI | 53c | $1.05 | Premium quality, best motion |
wan | FAL.AI | 30c | --- | Fast generation |
grok | xAI | 38c | 75c | Requires 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
- Agent calls the tool --- the MCP server runs inside the computer service
- Balance pre-check --- verifies the organization has enough credits
- API call --- sends the request to FAL.AI or xAI depending on the model
- File saved --- downloads the result and saves it to the workspace
- 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
outputPathwith a meaningful filename - Use
checkBalancebefore expensive video generation - For blog images, use
landscape_16_9aspect ratio - For profile pictures, use
generateAvatar(notgenerateImagewithsquare) - 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:
| Model | Cost per Image |
|---|---|
grok-imagine-image | 3c |
flux-2-flex | 4c |
grok-imagine-image-pro | 11c |
grok-2-image-1212 | 11c |
Videos:
| Model + Duration | Cost |
|---|---|
wan 5s | 30c |
grok 5s | 38c |
kling 5s | 53c |
grok 10s | 75c |
kling 10s | $1.05 |