Generate an AI image
June 3, 2026 (November 16, 2026)
Table of contents
Generate an AI image from a text prompt. You get an encoded image asset ID, the same kind POST /files returns for an uploaded image. Pass it as a reference image (refImage1 to refImage10) to POST /music.
https://api.useapi.net/v1/flowmusic/files/generate
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Or send the same fields as multipart/form-data:
# Content-Type: multipart/form-data
API tokenis required. Setup useapi.net shows where to get it.
Request Body
{
"prompt": "abstract neon city skyline at night"
}
promptis required. The image description.
Maximum length:2000characters.emailis optional. The Google Flow Music account. Left out, any healthy account is used.
Responses
-
The image, 1024 by 1024 pixels: its asset id
id, its linkurland the account that made it. Send the id as a refImage of POST /music.{ "id": "user:[email protected]:d8293bc4-1e99-4569-827d-cdf5a4ad52b4", "url": "https://storage.googleapis.com/producer-app-public/assets/d8293bc4-1e99-4569-827d-cdf5a4ad52b4.jpg", "kind": "image", "assetType": "image", "email": "[email protected]", "width": 1024, "height": 1024, "model": "google-generative-ai" } -
The request itself is wrong, or no usable Google Flow Music account is added. The error text says what to change.
{ "error": "request body is empty (send the file bytes as the raw body)", "code": 400 }{ "error": "No healthy Google Flow Music accounts available", "code": 400 }{ "error": "Please configure at least one account at https://useapi.net/docs/api-flowmusic-v1/post-flowmusic-accounts", "code": 400 }{ "error": "Invalid JSON: Unexpected token 'o', \"not json\" is not valid JSON", "code": 400 } -
The useapi.net API token is missing or wrong.
A step at Google Flow Music failed with 401: it refused the account’s sign-in. The error text names the step.
{ "error": "Upload failed (HTTP 401): Upstream returned an error with an unreadable body (connection closed before the body arrived).", "code": 401 }{ "error": "Google Flow Music image generation failed (401): {\"detail\":\"Unauthorized\"}", "code": 401 }{ "error": "useapi.net ⁝ Unauthorized", "code": 401 } -
The useapi.net subscription is not active.
{ "error": "useapi.net ⁝ Your account has no subscription, please subscribe to our services before submitting requests", "code": 402 } -
The account, job or clip does not exist, or is no longer there.
{ "error": "Account [email protected] not found", "code": 404 } -
Google Flow Music refused the request because this account sent too many at once. Retry once a running generation finishes, or a little later.
{ "error": "Upload failed (HTTP 429): Upstream returned an error with an unreadable body (connection closed before the body arrived).", "code": 429 }{ "error": "Google Flow Music image generation failed (429): {\"detail\":\"Too Many Requests\"}", "code": 429 } -
Something failed on our side.
A step at Google Flow Music failed with 500. The error text names the step.
{ "error": "Cannot read properties of undefined (reading 'email')", "code": 500 }{ "error": "Upload failed (HTTP 500): Upstream returned an error with an unreadable body (connection closed before the body arrived).", "code": 500 }{ "error": "Google Flow Music image generation failed (500): \"Internal Server Error\"", "code": 500 } -
Google Flow Music answered with an error, or did not answer. The error text says what happened.
{ "error": "Google Flow Music upload returned an unreadable/empty body", "code": 502 }{ "error": "Image gen response missing image_id: null", "code": 502 }{ "error": "Upstream network failure after 4 attempts: Network connection lost.", "code": 502 }{ "error": "Upstream fetch produced no response", "code": 502 } -
The Google Flow Music sign-in service did not answer, or another request is renewing the account’s sign-in right now. The account is unchanged. Retry in a minute, or after Retry-After when it is sent. On any call, it can also mean our service was busy for a moment.
{ "error": "Another request is refreshing the Google Flow Music sign-in of [email protected] right now. Retry in a few seconds.", "code": 503 }{ "error": "Google Flow Music's sign-in service did not answer (500). Retry in a minute.", "code": 503 } -
596 Account Error
The account is in an error state. Add it again with POST /accounts.
{ "error": "Account [email protected] in error state: Google Flow Music signed out [email protected]: its sign-in can no longer be refreshed (refresh_token_already_used), usually because it was refreshed somewhere else. Add the account again: https://useapi.net/docs/start-here/setup-flowmusic", "code": 596 }{ "error": "Google Flow Music signed out [email protected]: its sign-in can no longer be refreshed (refresh_token_already_used), usually because it was refreshed somewhere else. Add the account again: https://useapi.net/docs/start-here/setup-flowmusic", "code": 596 }
Model
The generated image’s asset id, to pass as a reference image to POST /music, with its URL, width, height and image model.
The image
{ // TypeScript, fields marked ? may be absent
id: string // the encoded image asset id: use it as refImage1 to refImage10 in POST /music
url: string // the image file, a public link
kind: "image" // always image
assetType: "image" // always image
email: string // the Google Flow Music account that holds the image
width: number // the width in pixels
height: number // the height in pixels
model: string // the image model Google Flow Music used
}
Examples
-
curl -X POST "https://api.useapi.net/v1/flowmusic/files/generate" \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"prompt":"abstract neon city skyline at night"}' -
const response = await fetch('https://api.useapi.net/v1/flowmusic/files/generate', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify({ "prompt": "abstract neon city skyline at night" }) }) console.log(response.status, await response.json()) -
import requests response = requests.post( 'https://api.useapi.net/v1/flowmusic/files/generate', headers={'Authorization': 'Bearer YOUR_API_TOKEN'}, json={ 'prompt': 'abstract neon city skyline at night' }, ) print(response.status_code, response.json())