Generate an AI image
June 3, 2026
Table of contents
Generate an AI image from a text prompt. Returns an encoded image asset ID β the same shape POST /files returns for an uploaded image β that you can pass as a reference image (refImage1β¦) to POST /music.
https://api.useapi.net/v1/flowmusic/files/generate
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": "abstract neon city skyline at night" }
emailis optional, which configured account to use.promptis required, the image description. 1β2,000 characters.
Responses
-
{ "id": "user:[email protected]:...", "url": "https://storage.googleapis.com/producer-app-public/assets/....jpg", "kind": "image", "assetType": "image", "email": "[email protected]", "width": 1024, "height": 1024, "model": "google-generative-ai" } -
400 β missing/empty prompt.
-
401 Unauthorized β invalid API token.
-
500 β Flow Music declined the request. The most common cause is a moderated or otherwise disallowed prompt: Flow Music returns a generic
Internal Server Error(it does not say why) and we pass it through verbatim. Retry with a different prompt β if a clearly benign prompt still fails, it is likely a transient upstream error.{ "error": "FlowMusic image generation failed (500): \"Internal Server Error\"", "code": 500 } -
596 Account Error
The account targeted by
emailis in an error state and canβt be used β re-add it via POST /accounts. Theerrorfield returns whatever reason was recorded for the account.{ "error": "Account [email protected] in error state: refresh token rejected", "code": 596 }
Model
{
id: string // encoded image asset id β usable as refImage1β¦ in POST /music
url: string
kind: 'image'
assetType: 'image'
email: string
width: number
height: number
model: string // the image model, e.g. 'google-generative-ai'
}
Examples
-
curl -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -X POST "https://api.useapi.net/v1/flowmusic/files/generate" \ -d '{ "prompt": "abstract neon city skyline at night" }' -
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())