apyhub
ARTIFICIAL INTELLIGENCE · IMAGE PROCESSING

Generate Text to Image API

What it does

Image Generation creates one or more images from a text prompt and returns the result as base64 or a normalised image payload.

Send a prompt and optionally set n from 1 to 4, lane to fast or quality, size such as 1024x1024, tier (demo, registered, or paid), model, and private_by_default. The API responds with image items that can include index, width, height, asset_id, b64_json, mime_type, source_url, and revised_prompt. The /generate endpoint also returns top-level fields like n, size, model, prompt, job_id, status, created, mime_type, image_base64, and latency_seconds.

Use Image Generation when you need programmatic visuals for product mockups, content workflows, automated asset creation, or internal tools that turn prompts into images. The returned base64 payload makes it easy to store, transmit, or post-process generated images without an extra download step.

If you need a version that returns normalized image assets instead of only inline base64, use /generations. Both endpoints accept the same prompt-driven request shape, so you can switch between response formats without changing how you build the request.

▣ ENDPOINT 01 / 03
POST
Generate one or more images with base64 normalization
http://localhost:8080/dosvak/generate-images/generations
QUICKSTARTGUIDE

Quickstart

Generate one image from a prompt using the default model and settings.

curl -X POST "http://localhost:8080/dosvak/generate-images/generations" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "prompt": "A cozy cabin in a snowy forest at sunset",
  "model": "black-forest-labs/FLUX.1-schnell",
  "lane": "fast"
}'

What you'll get back

Returns a JSON object with these top-level fields: data (an array of image result objects), and optional model, job_id, status, created, and latency_seconds fields.

Each item in data can include index, width, height, asset_id, b64_json, mime_type, source_url, and revised_prompt.

{
  "data": [
    {
      "index": 0,
      "width": 1024,
      "height": 1024,
      "source_url": "https://..."
    }
  ],
  "model": "black-forest-labs/FLUX.1-schnell",
  "job_id": "job_123",
  "status": "completed",
  "created": 1710000000,
  "latency_seconds": 2.4
}
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*

About this endpoint

What it does

Generates one or more images from a text prompt and returns them in a JSON response. The response includes a data array of image result objects, along with optional metadata such as model, job_id, status, created, and latency_seconds.

Request Body

ParameterTypeMandatoryDescription
promptStringYesText prompt used to generate the images.
nIntegerNoNumber of images to generate. Default: 1. Minimum: 1. Maximum: 4.
laneENUMNoGeneration lane. Allowed values: fast, quality. Default: fast.
sizeStringNoOutput image size in WIDTHxHEIGHT format. Default: 1024x1024. Pattern: ^[0-9]{2,4}x[0-9]{2,4}$.
tierENUMNoTier. Allowed values: demo, registered, paid. Default: demo.
modelStringNoModel identifier. Default: black-forest-labs/FLUX.1-schnell.
private_by_defaultBooleanNoWhether generated assets are private by default. Default: true.

Response

Returns a JSON object with a data array of result objects. Each result object can include index, width, height, asset_id, b64_json, mime_type, source_url, and revised_prompt; the top level may also include model, job_id, status, created, and latency_seconds.

ParameterTypeMandatoryDescription
dataObject ArrayNoArray of image result objects. Each item may include:<br>index (Integer)<br>width (Integer, nullable)<br>height (Integer, nullable)<br>asset_id (String, nullable)<br>b64_json (String, nullable)<br>mime_type (String, nullable)<br>source_url (String, nullable)<br>revised_prompt (String, nullable)
modelStringNoModel associated with the response. Nullable.
job_idStringNoJob identifier. Nullable.
statusStringNoStatus value. Nullable.
createdIntegerNoCreation timestamp. Nullable.
latency_secondsNumberNoRequest latency in seconds. Nullable.

Body

Name
Type
Description
bodyREQUIRED
object
▣ ENDPOINT 02 / 03
POST
Generate one or more images and return base64
http://localhost:8080/dosvak/generate-images/generate
QUICKSTARTGUIDE

Quickstart

Generate one image from a simple text prompt.

curl -X POST "http://localhost:8080/dosvak/generate-images/generate" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A cozy mountain cabin at sunrise"
  }'

What you'll get back

Returns a JSON object with top-level fields such as n (integer), data (array of image result objects), size (string), model (string), job_id (string or null), prompt (string), status (string or null), created (integer or null), mime_type (string or null), image_base64 (string or null), and latency_seconds (number or null).

Each item in data is an object that may include index, width, height, asset_id, b64_json, mime_type, source_url, and revised_prompt.

{
  "n": 1,
  "data": [
    {
      "index": 0,
      "source_url": "https://..."
    }
  ],
  "size": "1024x1024",
  "model": "black-forest-labs/FLUX.1-schnell",
  "prompt": "A cozy mountain cabin at sunrise"
}
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*

About this endpoint

What it does

Generates one or more images from a text prompt and returns a JSON object containing the requested generation details and image data. The request body includes the prompt and optional generation settings; the response includes fields such as data, n, size, and model, with image content available in the returned JSON structure.

Header(s)

AttributeTypeMandatoryDescription
x-rapidapi-proxy-secretStringNoSecret header forwarded by the gateway.

Request Body

ParameterTypeMandatoryDescription
nIntegerNoNumber of images to generate. Default: 1; minimum: 1; maximum: 4.
laneENUMNoGeneration lane. Allowed values: fast, quality. Default: fast.
sizeStringNoImage size in WIDTHxHEIGHT format. Default: 1024x1024. Pattern: ^[0-9]{2,4}x[0-9]{2,4}$.
tierENUMNoAccess tier. Allowed values: demo, registered, paid. Default: demo.
modelStringNoModel identifier. Default: black-forest-labs/FLUX.1-schnell.
promptStringYesText prompt used to generate the image(s).
private_by_defaultBooleanNoWhether generated assets are private by default. Default: true.

Response

Returns a JSON object with top-level fields including n (Integer), data (Object Array), size (String), model (String), job_id (String), prompt (String), status (String), created (Integer), mime_type (String), image_base64 (String), and latency_seconds (Number). The data array contains image result objects, each with fields such as index, width, height, asset_id, b64_json, mime_type, source_url, and revised_prompt.

ParameterTypeMandatoryDescription
nIntegerNoNumber of images associated with the response.
dataObject ArrayNoArray of image result objects. Each item may include index, width, height, asset_id, b64_json, mime_type, source_url, and revised_prompt.
sizeStringNoImage size returned by the service.
modelStringNoModel identifier used for the generation.
job_idStringNoJob identifier, if returned by the service.
promptStringNoPrompt associated with the response.
statusStringNoStatus value returned by the service.
createdIntegerNoCreation timestamp returned by the service.
mime_typeStringNoMIME type associated with the response or generated image.
image_base64StringNoBase64-encoded image content, when provided at the top level.
latency_secondsNumberNoTime taken for the request, in seconds.

Body

Name
Type
Description
bodyREQUIRED
object
▣ ENDPOINT 03 / 03
GET
List configured generation models
http://localhost:8080/dosvak/generate-images
QUICKSTARTGUIDE

Quickstart

List the available generation models with the required proxy secret header.

curl -X GET "http://localhost:8080/dosvak/generate-images" \
  -H "apy-token: $APY_TOKEN" \
  -H "x-rapidapi-proxy-secret: $X_RAPIDAPI_PROXY_SECRET"

What you'll get back

Returns a JSON object with a data array of model objects and an object string. Each model object may include fields like id, root, object, parent, owned_by, permission, and max_model_len.

{
  "data": [
    {
      "id": "model-name",
      "root": null,
      "object": "model",
      "parent": null,
      "owned_by": "provider",
      "permission": [],
      "max_model_len": 8192
    }
  ],
  "object": "list"
}
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.

About this endpoint

What it does

Returns the configured generation models as a JSON object containing a data array and an object string.

Header(s)

AttributeTypeMandatoryDescription
x-rapidapi-proxy-secretStringYesSecret header required by the endpoint.

Response

Returns a JSON object with a data array field and an object string field. The data array contains model objects with id, root, object, parent, owned_by, permission, and max_model_len fields.

AttributeTypeMandatoryDescription
dataObject ArrayYesArray of model objects. Each item includes:<br>- id (String)<br>- root (String, nullable)<br>- object (String)<br>- parent (nullable, type not specified in the schema)<br>- owned_by (String)<br>- permission (Object Array) with items containing id (String) and object (String)<br>- max_model_len (Integer, nullable)
objectStringYesString value returned at the top level of the response.

Headers

Name
Type
Description
x-rapidapi-proxy-secretOPTIONAL
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.