문서
Video generation API
Video jobs are priced per second: a 5-second Veo 3.1 Fast clip at 1080p·audio costs $0.125 ($0.025 × 5), and parameters.duration takes 1 to 60 whole seconds.
Request
| Field | Type | Notes |
|---|---|---|
model |
string | A video model id from /models, e.g. google/veo-3.1-fast |
input.type |
string | text, image, reference |
input.prompt |
string | What happens in the clip |
input.references |
array | Roles: first_frame, last_frame, reference_image, reference_video, reference_audio |
parameters.duration |
integer | Required, 1–60 seconds; price × seconds |
parameters.resolution |
string | Selects the price row, e.g. 480p, 720p, 1080p |
parameters.generate_audio |
boolean | On models that sell audio and silent specs separately |
cURL
bash
curl https://useflowapi.com/v1/generations \
-H "Authorization: Bearer $FLOWAPI_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-1234-video" \
-d '{"model":"google/veo-3.1-fast","input":{"type":"text","prompt":"A paper boat drifting down a stream"},"parameters":{"resolution":"1080p","generate_audio":true,"duration":5}}'
TypeScript (fetch, Node 18+)
ts
const res = await fetch('https://useflowapi.com/v1/generations', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.FLOWAPI_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': 'order-1234-video',
},
body: JSON.stringify({
"model": "google/veo-3.1-fast",
"input": {
"type": "text",
"prompt": "A paper boat drifting down a stream"
},
"parameters": {
"resolution": "1080p",
"generate_audio": true,
"duration": 5
}
}),
});
const job = await res.json();
console.log(job.id, job.status, job.price.amount);
Python (requests)
python
import os, requests
res = requests.post(
"https://useflowapi.com/v1/generations",
headers={
"Authorization": f"Bearer {os.environ['FLOWAPI_KEY']}",
"Idempotency-Key": "order-1234-video",
},
json={
"model": "google/veo-3.1-fast",
"input": {
"type": "text",
"prompt": "A paper boat drifting down a stream"
},
"parameters": {
"resolution": "1080p",
"generate_audio": True,
"duration": 5
}
},
)
job = res.json()
print(job["id"], job["status"], job["price"]["amount"])
Image-to-video
json
{
"model": "google/veo-3.1-fast",
"input": {
"type": "image",
"prompt": "The camera slowly pushes in",
"references": [{ "role": "first_frame", "file_id": "file_…" }]
},
"parameters": { "duration": 5 }
}
Each model accepts its own set of modes and roles; a combination the model does not take is refused with 400 FLOW_INVALID_REQUEST before anything is charged.
Timing
Video jobs run asynchronously. Poll GET /v1/jobs/{id} every few seconds; a job still unfinished after 90 minutes is marked failed and refunded.
FAQ
- How is video priced?
- Per second of output: the spec's per-second price times parameters.duration, so 5 seconds of Veo 3.1 Fast costs $0.125.
- Is duration required?
- Yes. Every video request needs parameters.duration as a whole number from 1 to 60.
- Can I animate my own image?
- Yes. Set input.type to image and pass the picture in input.references with role first_frame.