apyhub

Generate Text to Image Job API

What it does

GPU Image Generation creates images from text prompts and returns a task you can poll for progress. Use it when you need fast, model-backed image generation without managing your own inference stack.

Send a prompt and, optionally, seed, steps, width, and height to the Flux.1-Schnell endpoint or the SDXL-Turbo endpoint. The Turbo variant also accepts negative_prompt so you can steer the output away from unwanted elements. Both generation endpoints respond with status, message, and task_id, which you use with GET /tasks/:task_id to check progress.

Polling /tasks/:task_id returns the current status, a human-readable message, the task_id, and, when the task is complete, an output_url for the generated file. If the task fails, the same status response includes error.

This service fits product features like prompt-based asset creation, concept mockups, social content generation, or internal design tooling where developers need an image job API with asynchronous results and reproducible seeds.

▣ ENDPOINT 01 / 03
POST
Text-to-Image (Flux.1-Schnell)
http://localhost:8080/mastera-ai/image-generation/v1/flux/generate
QUICKSTARTGUIDE

Quickstart

Start an image generation job by sending a prompt and the default image settings.

curl -X POST "http://localhost:8080/mastera-ai/image-generation/v1/flux/generate" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A serene mountain lake at sunset, oil painting style",
    "seed": 0,
    "steps": 4,
    "width": 1024,
    "height": 768
  }'

What you'll get back

Returns a JSON object with status, message, and task_id string fields. status indicates the job state, message explains that generation has started, and task_id is the ID you can use to check the result later.

{
  "status": "processing",
  "message": "Generation started. Poll GET /v1/tasks/{task_id} for result.",
  "task_id": "a1b2c3d4e5f6"
}
TRY ITLIVE · 120 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Random seed for reproducible generation.
Number of inference steps.
Output image width in pixels.
Output image height in pixels.
The text description of the image to generate.

About this endpoint

What it does

Starts a text-to-image generation request using Flux.1-Schnell. You send a prompt plus optional generation settings, and the endpoint returns a task identifier to track the job.

Request Body

ParameterTypeMandatoryDescription
promptStringYesThe text description of the image to generate.
seedIntegerNoRandom seed for reproducible generation. Default: 0.
stepsIntegerNoNumber of inference steps. Default: 4. Minimum: 1. Maximum: 20.
widthIntegerNoOutput image width in pixels. Default: 1024. Minimum: 256. Maximum: 1536.
heightIntegerNoOutput image height in pixels. Default: 768. Minimum: 256. Maximum: 1536.

Response

Returns a JSON object with status, message, and task_id string fields. The status field indicates the request has started processing, message provides the handoff instruction, and task_id is the identifier to use when checking the job result.

ParameterTypeMandatoryDescription
statusStringNoJob state returned by the endpoint. Example: processing.
messageStringNoHuman-readable status message. Example: Generation started. Poll GET /v1/tasks/{task_id} for result.
task_idStringNoIdentifier for the generation task. Example: a1b2c3d4e5f6.

Notes

This endpoint kicks off an async job and returns immediately with a job identifier; the actual work runs in the background. Pair this call with the corresponding job_check endpoint — poll that until the status reaches a terminal state to retrieve the result. Extract the job id from task_id.

Body

Name
Type
Description
bodyREQUIRED
object
▣ ENDPOINT 02 / 03
POST
Ultra-fast Text-to-Image (SDXL-Turbo)
http://localhost:8080/mastera-ai/image-generation/v1/sdxl/generate
QUICKSTARTGUIDE

Quickstart

Start an image generation task by sending a prompt.

curl -X POST "http://localhost:8080/mastera-ai/image-generation/v1/sdxl/generate" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A red sports car on a coastal road, golden hour"
  }'

What you'll get back

Returns a JSON object with status, message, and task_id string fields. status shows the task state, message gives a short note, and task_id is the ID you can use to poll for the result.

{
  "status": "processing",
  "message": "Generation started. Poll GET /v1/tasks/{task_id} for result.",
  "task_id": "a1b2c3d4e5f6"
}
TRY ITLIVE · 100 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Random seed for reproducible generation.
Number of inference steps (1-4 recommended for Turbo).
Output image width in pixels (SDXL-Turbo is tuned for 512).
Output image height in pixels (SDXL-Turbo is tuned for 512).
The text description of the image to generate.
What to avoid in the generated image.

About this endpoint

What it does

Starts an ultra-fast text-to-image generation request using SDXL-Turbo from a text prompt. The request returns a task identifier so you can check the job later for the generated image result.

Request Body

ParameterTypeMandatoryDescription
promptStringYesThe text description of the image to generate.
seedIntegerNoRandom seed for reproducible generation. Default: 0.
stepsIntegerNoNumber of inference steps. Default: 4. Range: 1 to 20 (1–4 recommended for Turbo).
widthIntegerNoOutput image width in pixels. Default: 512. Range: 256 to 1536 (SDXL-Turbo is tuned for 512).
heightIntegerNoOutput image height in pixels. Default: 512. Range: 256 to 1536 (SDXL-Turbo is tuned for 512).
negative_promptStringNoWhat to avoid in the generated image. Default: empty string.

Response

Returns a JSON object with status, message, and task_id string fields. status indicates the current task state, message provides a human-readable update, and task_id is the identifier you use to poll for the result.

ParameterTypeMandatoryDescription
statusStringNoTask status.
messageStringNoHuman-readable message about the request.
task_idStringNoIdentifier for the generated task.

Notes

This endpoint kicks off an async job and returns immediately with a job identifier; the actual work runs in the background. Pair this call with the corresponding job_check endpoint — poll that until the status reaches a terminal state to retrieve the result. Extract the task_id field from the response.

Body

Name
Type
Description
bodyREQUIRED
object
▣ ENDPOINT 03 / 03
GET
Poll task status
http://localhost:8080/mastera-ai/image-generation/v1/tasks/:task_id
QUICKSTARTGUIDE

Quickstart

Check the status of a task by its task_id.

curl -X GET "http://localhost:8080/mastera-ai/image-generation/v1/tasks/:task_id" \
  -H "apy-token: $APY_TOKEN"

What you'll get back

Returns a JSON object with optional top-level fields such as type, error, status, message, task_id, and output_url, depending on the task state.

{
  "type": "flux_t2i",
  "status": "completed",
  "message": "Task completed successfully.",
  "task_id": "a1b2c3d4e5f6",
  "output_url": "https://example.com/generated-image.png"
}
TRY ITLIVE · 0 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.

About this endpoint

What it does

Polls the status of an image generation task by task_id and returns the task’s current state, optional progress message, and any final output or error information when available.

Path Parameter(s)

AttributeTypeMandatoryDescription
task_idStringYesThe task identifier.

Response

Returns a JSON object with type, error, status, message, task_id, and output_url fields. status reports the task state, message provides a human-readable progress update, and output_url is present only when the task completes successfully.

AttributeTypeMandatoryDescription
typeENUMNoThe generation task type. Allowed values: flux_t2i, sdxl_t2i, ltx_t2v.
errorStringNoError message. Present only when status is error.
statusENUMNoThe task status. Allowed values: processing, generating, completed, error.
messageStringNoHuman-readable progress message.
task_idStringNoThe task identifier.
output_urlStringNoURL to the generated file. Present only when status is completed.

Path parameters

Name
Type
Description
task_idREQUIRED
string
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.