Generate with the Flux API in three steps
Create a key, submit a generation and retrieve the result.
Create an API key
Create an API keyCreate a key in your Flux account and store it in your server environment as FLUX_API_KEY.
Send a generation request
curl -X POST "https://api.flux-context.org/api/v1/generations" \
-H "Authorization: Bearer $FLUX_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: YOUR_UNIQUE_REQUEST_ID" \
-d '{
"model": "wan3",
"input": {
"mode": "text-to-video",
"prompt": "A calm seaside sunrise with gentle camera movement",
"resolution": "480p",
"duration": 4,
"sound": false,
"aspect_ratio": "16:9"
}
}'{
"id": "REQUEST_ID",
"status": "processing"
}Retrieve the result
Use the returned request ID to check the job. When it succeeds, open a URL from the results list.
curl "https://api.flux-context.org/api/v1/generations/REQUEST_ID" -H "Authorization: Bearer $FLUX_API_KEY"