MuseSpark
MuseSpark
Models & toolsVideo models

Veo 3.1 API guide

Veo 3.1 API: Generate video from text, a first frame, or first and last frames with Veo 3.1. Use the matching generation_type and ordered image inputs, then choose output settings.

Model overview

Generate video from text, a first frame, or first and last frames with Veo 3.1. Use the matching generation_type and ordered image inputs, then choose output settings.

API integration

DocumentationValue
API invocation identifierveo-3.1-quality
IntegrationAsync task API

Use this invocation identifier in API requests. Check your authorized model catalog for access. Follow the Quickstart for your first complete call.

Request parameters

Select a mode to highlight its required inputs. Mode selection does not change the API field names.

Studio presets describe the form setup, not guaranteed server defaults. Send preset values explicitly to reproduce them.

promptstringNon-nullRequired

Text description of the video to generate.

Length: minimum 1.

image_urlsarray<string>Non-nullConditional

Required for First Frame, First and Last Frames.

Additional requirements depend on other values. See model rules.

Up to two public HTTP(S) JPEG, PNG or WebP images, each at most 10 MB. One image sets the first frame; two set the first and last frames. Reference-image fusion is not supported.

Item count: maximum 2.

Media types: image/jpeg, image/png, image/webp.

generation_typestringNon-nullOptional

Video generation type. Only Frame (first/last frame to video) is supported; Reference mode is not supported.

Allowed values: "frame".

resolutionstringNon-nullOptional

Video output resolution. Supports 720p (default), 1080p, and 4K. GIF output is limited to 720p.

Allowed values: "720p", "1080p", "4k".

Studio preset: "720p".

durationintegerNon-nullOptional

Video output duration in seconds. The model is fixed at 8 seconds.

Allowed values: 8.

Studio preset: 8.

aspect_ratiostringNon-nullOptional

Video output aspect ratio. Supports 16:9 (landscape) and 9:16 (portrait); defaults to 16:9.

Allowed values: "16:9", "9:16".

Studio preset: "16:9".

enable_gifbooleanNon-nullOptional

Whether to generate a GIF output as well. Disabled by default; GIF cannot be used with 1080p or 4K.

Studio preset: false.

nsfw_checkbooleanNon-nullOptional

Whether to run content moderation before submitting the video task. Disabled by default.

Studio preset: false.

No parameters match. Clear the search or reset the filters.

Model rules

Input modes

Select a mode by supplying its required public inputs. The mode identifier describes a documentation/form choice; do not send input_mode as a model parameter.

ModeRequired inputs
Text to VideoNo reference media required
First Frameimage_urls
First and Last Framesimage_urls
  • When enable_gif is true, use 720p for resolution.
  • When generation_type is "frame", keep image_urls, when supplied, at most 2 items.
  • When image_urls is provided, keep image_urls, when supplied, at most 2 items.
  • When the input mode is Text to Video, omit image_urls.
  • When the input mode is First Frame, provide image_urls; use frame for generation_type; keep image_urls, when supplied, at least 1 and at most 1 items.
  • When the input mode is First and Last Frames, provide image_urls; use frame for generation_type; keep image_urls, when supplied, at least 2 and at most 2 items.

Parameter meaning

  • Veo 3.1 generation uses a fixed-duration request. Changing reference count does not request a longer video.

Dependencies

  • Frame control and subject-reference generation are distinct modes. Their image counts and model-variant support differ.
  • GIF output cannot be combined with the high-resolution video tiers for this integration.

Request examples

Replace example media URLs and YOUR_... input identifiers with your own valid resources. Examples are checked against the exported item schema; media access and paid execution are separate runtime checks.

Set MUSESPARK_API_KEY and a stable MUSESPARK_REQUEST_ID before submitting. Preserve the request ID for retries of the same request and use a new ID for new work. Python examples use requests; JavaScript examples use Node.js 20 or later. The standalone Quickstart includes task polling and recovery.

Text to Video

curl --fail-with-body 'https://api.musespark.ai/api/v1/openapi/task' \
  -H "Authorization: Bearer $MUSESPARK_API_KEY" \
  -H "X-Idempotency-Key: $MUSESPARK_REQUEST_ID" \
  -H 'Content-Type: application/json' \
  -d '{
  "item_key": "veo-3.1-quality",
  "parameters": {
    "duration": 8,
    "enable_gif": false,
    "nsfw_check": false,
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "prompt": "A paper city under soft morning light"
  }
}'

Parameters used: duration · enable_gif · nsfw_check · resolution · aspect_ratio · prompt.

First Frame

curl --fail-with-body 'https://api.musespark.ai/api/v1/openapi/task' \
  -H "Authorization: Bearer $MUSESPARK_API_KEY" \
  -H "X-Idempotency-Key: $MUSESPARK_REQUEST_ID" \
  -H 'Content-Type: application/json' \
  -d '{
  "item_key": "veo-3.1-quality",
  "parameters": {
    "duration": 8,
    "enable_gif": false,
    "nsfw_check": false,
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "prompt": "A paper city under soft morning light",
    "image_urls": [
      "https://example.com/input-1.png"
    ]
  }
}'

Parameters used: duration · enable_gif · nsfw_check · resolution · aspect_ratio · prompt · image_urls.

First and Last Frames

curl --fail-with-body 'https://api.musespark.ai/api/v1/openapi/task' \
  -H "Authorization: Bearer $MUSESPARK_API_KEY" \
  -H "X-Idempotency-Key: $MUSESPARK_REQUEST_ID" \
  -H 'Content-Type: application/json' \
  -d '{
  "item_key": "veo-3.1-quality",
  "parameters": {
    "duration": 8,
    "enable_gif": false,
    "nsfw_check": false,
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "prompt": "A paper city under soft morning light",
    "image_urls": [
      "https://example.com/input-1.png",
      "https://example.com/input-2.png"
    ]
  }
}'

Parameters used: duration · enable_gif · nsfw_check · resolution · aspect_ratio · prompt · image_urls.

Output

Creation returns a task ID inside data. Poll that task until completion, then save data.result.output_urls and any data.result.batch_results. See the task lifecycle for terminal states, result retention, and errors.

Troubleshooting

For rejected inputs, check the field type, accepted values, and conditional requirements in Request parameters and Model rules. Correct the affected fields before submitting again.

If creation times out, preserve the request identity and any known task ID. Follow Errors, timeouts and retries before submitting again.

The public input snapshot was exported on 2026-11-09. Current prices and availability are listed in the model center.