Image & Video Generation
The gateway exposes two media endpoints alongside chat: /v1/images/generations for images (synchronous) and /v1/videos for videos (asynchronous jobs). Both are billed on the provider's exact reported usage — no markup per call.
Authentication
Same as every other endpoint — send your Mume API key as a bearer token. See Authentication for how to create one.
Authorization: Bearer $MUME_API_KEYImages
POST https://mume.ai/api/v1/images/generations returns the finished image in the response. The shape is OpenAI-compatible, so the OpenAI SDKs work unchanged.
cURL
curl https://mume.ai/api/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MUME_API_KEY" \
-d '{
"model": "google/gemini-2.5-flash-image",
"prompt": "A lone lighthouse on a basalt cliff at dusk, volumetric fog, 35mm",
"aspect_ratio": "16:9"
}'Python
import openai
client = openai.OpenAI(
api_key="your-api-key",
base_url="https://mume.ai/api/v1",
)
result = client.images.generate(
model="google/gemini-2.5-flash-image",
prompt="A lone lighthouse on a basalt cliff at dusk, volumetric fog, 35mm",
extra_body={"aspect_ratio": "16:9"},
)
print(result.data[0].url)Response
{
"created": 1753401600,
"id": "gen_01H...",
"data": [{ "url": "https://firebasestorage.googleapis.com/..." }],
"usage": { "cost": 0.078 }
}Generated images are stored for you and returned as a hosted URL. Pass "response_format": "b64_json" to get raw base64 back instead.
Parameters
| Parameter | Type | Description |
|---|---|---|
| model | string | Required. An image model slug, e.g. google/gemini-2.5-flash-image. |
| prompt | string | Required. What to generate. |
| aspect_ratio | string | 1:1, 16:9, 9:16, 4:3, 3:4. |
| input_references | array | Reference images for editing / style transfer. Support and the maximum count vary by model. |
| response_format | string | url (default) or b64_json. |
Editing with a reference image
Pass one or more images in input_references to edit or restyle them. URLs must be publicly reachable.
{
"model": "google/gemini-2.5-flash-image",
"prompt": "Make this scene look like a watercolour painting",
"input_references": [
{
"type": "image_url",
"image_url": { "url": "https://example.com/photo.jpg" }
}
]
}Videos
Video generation takes minutes, so it runs as a job. POST /v1/videos returns 202 with a job id immediately; poll GET /v1/videos/{id} until the status is completed or failed.
Submit a job
curl https://mume.ai/api/v1/videos \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MUME_API_KEY" \
-d '{
"model": "google/veo-3.1",
"prompt": "Slow dolly through a neon-lit ramen stall in the rain",
"aspect_ratio": "16:9"
}'{
"id": "vid_01H...",
"status": "pending",
"model": "google/veo-3.1"
}Poll for the result
curl https://mume.ai/api/v1/videos/vid_01H... \
-H "Authorization: Bearer $MUME_API_KEY"{
"id": "vid_01H...",
"status": "completed",
"model": "google/veo-3.1",
"url": "https://firebasestorage.googleapis.com/..."
}Status moves through pending → in_progress → completed | failed. On failure the response carries an error string. Credits are deducted once, when the job completes.
Image-to-video
Send a starting frame in frame_images to animate an existing image. frame_type is either first_frame or last_frame, and the URL must be publicly reachable.
{
"model": "google/veo-3.1",
"prompt": "The camera pushes in as the neon sign flickers",
"frame_images": [
{
"type": "image_url",
"image_url": { "url": "https://example.com/first-frame.jpg" },
"frame_type": "first_frame"
}
]
}Polling example
import time, requests
BASE = "https://mume.ai/api/v1"
headers = {"Authorization": f"Bearer {MUME_API_KEY}"}
job = requests.post(
f"{BASE}/videos",
headers=headers,
json={
"model": "google/veo-3.1",
"prompt": "Slow dolly through a neon-lit ramen stall in the rain",
"aspect_ratio": "16:9",
},
).json()
while True:
status = requests.get(f"{BASE}/videos/{job['id']}", headers=headers).json()
if status["status"] in ("completed", "failed"):
break
time.sleep(8)
print(status.get("url") or status.get("error"))Models & pricing
Image and video models use the same provider/model format as chat. Current families include Nano Banana (Gemini Image), GPT Image, FLUX.2, Seedream and Recraft for images, and Veo, Sora, Kling, Hailuo, Seedance and Wan for video. The Media Studio lists everything available to your account with live per-model pricing.
Billing is pass-through on the provider's reported usage: images are charged per image (or per megapixel/token, depending on the model) and videos per second of output. Some higher-cost models are limited to Plus accounts — see Pricing.
Errors
Media endpoints use the same error envelope as the rest of the gateway. A few you may hit specifically here:
| Status | Meaning |
|---|---|
| 402 | Not enough credits for this generation. |
| 403 | The model is Plus-exclusive, or not served by the gateway. |
| 404 | Unknown video job id (or it belongs to another account). |
| 502 | The provider returned no media — safe to retry. |
See Error Handling for the full list and retry guidance.