Documentation
Image Generation
POST /v1/images/generations handles image generation, image editing, and — for some models — video generation. The same endpoint covers all three; the model you pick determines the behavior.
Synchronous example
By default, image models return the result inline. Use this when the model is fast (Flux, DALL·E, Imagen, gpt-image-1.5, etc.) and your client can wait for the response.
1curl -X POST https://api.navy/v1/images/generations \
2 -H "Authorization: Bearer sk-navy-YOUR_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "model": "flux",
6 "prompt": "A naval command room at dusk, cinematic lighting",
7 "size": "1024x1024"
8 }'Asynchronous example with sync false
Force a job-based workflow with "sync": false. The endpoint returns a job ID immediately and you poll for the result. Use this when your client can't hold a long-lived HTTP connection (serverless functions, browser fetches, gateways with short timeouts) or when you want to queue background work. See the Job Polling page for the full flow.
1curl -X POST https://api.navy/v1/images/generations \
2 -H "Authorization: Bearer sk-navy-YOUR_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "model": "flux",
6 "prompt": "A naval command room at dusk, cinematic lighting",
7 "size": "1024x1024",
8 "sync": false
9 }'Parameters
model(string, required) — Image or video model ID such asflux,dall-e-3,gpt-image-1.5,imagen-4,veo-3.1,sora-2prompt(string, required) — Text description of the desired image or videosize(string, optional) —"1024x1024"or aspect ratio like"16:9"aspect_ratio(string, optional) — Alternative tosizefor some models (e.g."1:1","9:16")image_url(string or array of up to 5 strings, optional) — Input or reference image(s) for editing. Accepts HTTPS URLs ordata:URIs. Use an array to combine multiple references on supported models.negative_prompt(string, optional) — What to avoid in the generated imageseed(integer, optional) — Random seed for reproducible generationquality(string, optional) —"low"or"medium"(other values are stripped)style(string, optional) — DALL·E 3 only:"vivid"or"natural"seconds(number, optional) — Video duration in seconds, clamped to 0–10 (video models only)sync(boolean, optional) — Defaults totruefor image models. Setfalseto get a job ID and poll asynchronously. Video models always run async regardless of this flag.response_format(string, optional) —"url"(default) or"b64_json"to receive a base64-encoded payload. Accepts"base64"and"base64_json"as aliases.
Async behavior at a glance
- Image models, default (`sync: true`) — Response returns inline with
data[].urlordata[].b64_json. - Image models, `sync: false` — Response returns a job; poll
GET /v1/images/generations/:id. - Video models — Always async by default. You almost always receive a job; expect generation times up to 10 minutes.
Notes
- Compatible editing models accept
image_urlas a string or an array (max 5). - Multi-reference editing example:
"image_url": ["https://example.com/a.png", "https://example.com/b.png", "https://example.com/c.png"] - Responses with
b64_jsonmay also include aurlfield pointing to a hosted copy so you don't have to upload it yourself. n(multiple images per request) is not supported — request one image per call.- See the Job Polling page for the full async lifecycle, status values, and error codes.