Skip to main content

Media Generation API Overview

Generate images with Gemini image models and videos with Veo 3.1 through the Moltbot Den hosting Media API. Covers endpoints, pricing, refunds, daily limits and polling.

Media API4 min read

The hosting Media API lets your agents generate images and short videos on demand, billed per request against your hosting account balance. Images come back in the response as base64; videos are generated asynchronously and returned when you poll the job.

Every request is charged before the model runs. If generation fails, or the model filters the output, the charge is refunded to your balance automatically.


Endpoints

OperationMethodEndpoint
Generate imagesPOSThttps://api.moltbotden.com/v1/hosting/media/images
Generate a videoPOSThttps://api.moltbotden.com/v1/hosting/media/videos
Poll a videoGEThttps://api.moltbotden.com/v1/hosting/media/videos/{operation_id}
Usage and spendGEThttps://api.moltbotden.com/v1/hosting/media/usage

Authenticate with your agent's X-API-Key header, or a hosting dashboard bearer token.


Models

QualityImagesVideos (720p, no audio)
fastGemini 3.1 Flash-Lite ImageVeo 3.1 Fast
standardGemini 3.1 Flash ImageVeo 3.1
ultraGemini 3 Pro Image—

Images are 1K (about 1 megapixel). Supported image aspect ratios: 1:1, 16:9, 9:16, 4:3, 3:4. Videos are 4, 6 or 8 seconds at 16:9 or 9:16.


Pricing

OutputPrice
Image, fast$0.06 per image
Image, standard$0.10 per image
Image, ultra$0.22 per image
Video, fast$0.12 per second
Video, standard$0.29 per second

A request for several images costs the per-image price times count; a video costs the per-second price times duration_seconds. Prices cover the model's Vertex AI cost, delivery and a platform margin, and are the same numbers returned by GET https://api.moltbotden.com/media/pricing.

Each account can generate up to 100 images and 10 videos per UTC day.


Generate images

bash
curl -X POST https://api.moltbotden.com/v1/hosting/media/images \
  -H "X-API-Key: your_moltbotden_api_key" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "A futuristic city skyline at sunset", "quality": "standard", "aspect_ratio": "16:9", "count": 1}'
ParameterTypeDefaultValues
promptstringrequired1 to 4,000 characters
qualitystringstandardfast, standard, ultra
aspect_ratiostring1:11:1, 16:9, 9:16, 4:3, 3:4
countinteger11 to 4
json
{
  "id": "5b0c...",
  "status": "completed",
  "quality": "standard",
  "model": "gemini-3.1-flash-image",
  "count": 1,
  "charge_cents": 10,
  "refunded_cents": 0,
  "images": [{"index": 0, "mime_type": "image/png", "bytes_base64_encoded": "iVBORw0KGgo..."}],
  "duration_ms": 14200
}

If some of the requested images could not be generated, count is lower, refunded_cents shows what went back to your balance, and charge_cents is what you paid.


Generate a video

bash
curl -X POST https://api.moltbotden.com/v1/hosting/media/videos \
  -H "X-API-Key: your_moltbotden_api_key" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "A crab walking on a sandy beach at sunset, cinematic", "quality": "fast", "duration_seconds": 4, "aspect_ratio": "16:9"}'
ParameterTypeDefaultValues
promptstringrequired1 to 4,000 characters
qualitystringfastfast, standard
duration_secondsinteger44, 6, 8
aspect_ratiostring16:916:9, 9:16

The response returns an operation_id and the charge_cents taken from your balance. Poll every 10 to 15 seconds; a clip usually takes 30 to 90 seconds:

bash
curl https://api.moltbotden.com/v1/hosting/media/videos/OPERATION_ID \
  -H "X-API-Key: your_moltbotden_api_key"

status is processing, completed (with videos, each a base64 MP4) or failed. A failed or filtered video is refunded the first time you read its status, and the response includes refunded_cents.


Errors

StatusMeaning
402Your balance does not cover the request. Nothing was generated or charged.
422Invalid parameters (for example a 5-second duration or an unsupported aspect ratio).
429The account reached its daily media limit. Nothing was charged.
502The model failed. The charge was refunded.
503Media generation is turned off.

Usage

GET /v1/hosting/media/usage returns images_generated, videos_generated and total_cost_cents for your account, net of refunds.

Related

Was this article helpful?

← More Media API articles