Edit images with AI models
June 3, 2025 (October 3, 2025)
Table of contents
This endpoint edits existing images using FLUX.1 Kontext, FLUX.1 Kontext Max, or Nano Banana / Gemini 2.5 Flash Image based on text prompts and reference images.
Model Capabilities
| Parameter | FLUX.1 Kontextflux (default) | FLUX.1 Kontext Maxflux-premium | Nano Banana / Gemini 2.5 Flash Imagenano-banana |
|---|---|---|---|
referenceAssetId | ✓ | ✓ | ✓ |
referenceAssetId2 | ✓ | ✓ | ✓ |
referenceAssetId3 | ✗ | ✓ | ✓ |
aspectRatio | ✓ | ✓ | ✗ |
https://api.useapi.net/v1/ltxstudio/images/edit
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
API tokenis required, see Setup useapi.net for details.
Request Body
{
"prompt": "Add golden sunset lighting to the landscape",
"referenceAssetId": "asset:3b18…-type:image/png",
"aspectRatio": "16:9",
"shotType": "wide shot",
"shotAngle": "eye-level",
"seed": 123456
}
emailis optional when only one account configured. However, if you have multiple accounts configured, this parameter becomes required.promptis required, text description for image editing (max 2000 characters)referenceAssetIdis required, asset ID for the source image to edit. Use fieldfileIdfrom POST assets/?type=reference-image or GET assets/?filter=images.referenceAssetId2is optional, second reference image asset ID.referenceAssetId3is optional, third reference image asset ID (see model capabilities table above).locationis optional, location description for the image (max 2000 characters).weatheris optional, weather conditions description (max 2000 characters).lightingis optional, lighting description (max 2000 characters).aspectRatiois optional, output image aspect ratio (see model capabilities table above).
Supported values:16:9,9:16,1:1.
Default:16:9.shotTypeis optional, type of shot for the image (e.g., “wide shot”, “close-up”, “medium shot”).shotAngleis optional, camera angle for the shot.
Supported values:eye-level,low-angle,over-the-shoulder,overhead,birds-eye-view.seedis optional, random seed for reproducible results.modelis optional, the AI model to use for image editing.
Supported values:flux,flux-premium,nano-banana.
Default:flux.pollForResultis optional, number of polling attempts to wait for completion (each attempt waits 3 seconds, up to 60 seconds total max) before sending job to the scheduler. For example,pollForResult: 5will poll every 3 seconds for up to 15 seconds total. Supported values:1-20. Default: immediate return withjobId.maxJobsis optional, override the default maximum number of concurrent jobs.replyUrlis optional, webhook URL for job completion notifications.
See GET assets/jobIdfor response model.replyRefis optional, custom reference for webhook identification.
Responses
-
{ "jobId": "email:[email protected]:7a34b821-9fd0-205e-d21b-4abc6f7839e7-type:image", "generationId": "gen_abc123def456" } -
200 OK (pollForResult completed)
{ "status": { "type": "completed", "progress": 100, "artifact": { "assetUrl": "https://storage.googleapis.com/lt-infinity-prd/artifacts/vertex-ai/…", "expirationDateString": "1748919477350", "asset": { "type": "artifact", "fileId": "asset:3b18…-type:image/png", "mimeType": "image/png", "artifactSubtype": "vertex-ai" } } }, "jobId": "email:[email protected]:7a34b821-9fd0-205e-d21b-4abc6f7839e7-type:image", "replyRef": "custom-reference-123", "replyUrl": "https://webhook.example.com/ltx-callback", "code": 200 } -
{ "error": "Error message", "code": 400 } -
{ "error": "Unauthorized", "code": 401 } -
{ "error": "Insufficient credits", "code": 402 }
Model
Use GET assets/jobId to retrieve job status and results if they were not provided with the response.
{ // TypeScript, all fields are optional
status: {
type: 'active' | 'completed' | 'failed'
progress?: number
message?: string
artifact?: {
assetUrl: string
expirationDateString: string
asset: {
type: string
fileId: string
mimeType: string
artifactSubtype: string
}
}
}
jobId?: string
generationId?: string
replyRef?: string
replyUrl?: string
code?: number
}
Examples
-
curl "https://api.useapi.net/v1/ltxstudio/images/edit" \ -H "Authorization: Bearer …" \ -H "Content-Type: application/json" \ -d '{ "prompt": "Add golden sunset lighting to the landscape", "referenceAssetId": "asset:3b18…-type:image/png", "aspectRatio": "16:9", "shotType": "wide shot", "shotAngle": "eye-level", "pollForResult": 10 }' -
const token = "API token"; const apiUrl = "https://api.useapi.net/v1/ltxstudio/images/edit"; const response = await fetch(apiUrl, { method: "POST", headers: { "Authorization": `Bearer ${token}`, "Content-Type": "application/json", }, body: JSON.stringify({ "prompt": "Add golden sunset lighting to the landscape", "referenceAssetId": "asset:3b18…-type:image/png", "aspectRatio": "16:9", "shotType": "wide shot", "shotAngle": "eye-level", "pollForResult": 10 }) }); const result = await response.json(); console.log("response", {response, result}); -
import requests token = "API token" apiUrl = "https://api.useapi.net/v1/ltxstudio/images/edit" headers = { "Authorization" : f"Bearer {token}", "Content-Type": "application/json" } data = { "prompt": "Add golden sunset lighting to the landscape", "referenceAssetId": "asset:3b18…-type:image/png", "aspectRatio": "16:9", "shotType": "wide shot", "shotAngle": "eye-level", "pollForResult": 10 } response = requests.post(apiUrl, headers=headers, json=data) print(response, response.json())