Skip to main content

Image Generation

Base URL: https://app.neuroflash.com/api/ds-prototypes

Pay-As-You-Go

Image generation is not yet available in the Pay-As-You-Go plan. It is currently only accessible through subscription plans that include image generation credits.

Generate Text2Image

POST/

Generate images from text prompts (text-to-image).

This endpoint mimics the fal.ai nano-banana API interface.

Request Body

FieldTypeRequiredDescription
promptstringYesThe text prompt to generate an image from
num_imagesintegerNoThe number of images to generate
aspect_ratiostringNoAspect ratio options for generated images
output_formatstringNoOutput format options for generated images
modelobjectNoThe model to use for image generation
limit_generationsbooleanNoLimit the number of generations to 1

Response

FieldTypeDescription
imagesarray<object>The generated images
urlstringThe URL where the file can be downloaded from
content_typestringThe mime type of the file
file_nameobjectThe name of the file
file_sizeobjectThe size of the file in bytes
widthobjectThe width of the image
heightobjectThe height of the image
image_idobjectThe unique ID of the image in storage
descriptionstringThe description of the generated images
promptstringThe prompt used to generate the images
detailobjectOptional detail message (e.g., quota warnings)
batch_idobjectBatch ID for grouping multiple images from one generation

Example

curl -X POST "https://app.neuroflash.com/api/ds-prototypes/" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-workspace-id: YOUR_WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"prompt": "string",
"num_images": 1,
"aspect_ratio": "string",
"output_format": "string",
"model": {},
"limit_generations": false
}'

Response:

{
"images": [
{
"url": "string",
"content_type": "string",
"file_name": {},
"file_size": {},
"width": {},
"height": {},
"image_id": {}
}
],
"description": "string",
"prompt": "string",
"detail": {},
"batch_id": {}
}

Generate Image2Image

POST/edit

Generate images from existing images and prompts (image-to-image).

This endpoint mimics the fal.ai nano-banana edit API interface.

Request Body

FieldTypeRequiredDescription
promptstringYesThe prompt for image editing
num_imagesintegerNoThe number of images to generate
aspect_ratiostringNoAspect ratio options with auto for image editing
output_formatstringNoOutput format options for generated images
modelobjectNoThe model to use for image generation
image_urlsarray<string>YesRelative paths of source images, taken from the output_image_url field returned by the /history endpoint. Do not pass absolute URLs.
limit_generationsbooleanNoLimit the number of generations to 1

Response

FieldTypeDescription
imagesarray<object>The generated images
urlstringThe URL where the file can be downloaded from
content_typestringThe mime type of the file
file_nameobjectThe name of the file
file_sizeobjectThe size of the file in bytes
widthobjectThe width of the image
heightobjectThe height of the image
image_idobjectThe unique ID of the image in storage
descriptionstringThe description of the generated images
promptstringThe prompt used to generate the images
detailobjectOptional detail message (e.g., quota warnings)
batch_idobjectBatch ID for grouping multiple images from one generation

Example

Use relative paths from history, not absolute URLs

The image_urls field expects the relative path returned in output_image_url from the /history endpoint — for example /api/ds-prototypes/image_generation/{image_id}/view. Do not construct absolute URLs (e.g. https://app.neuroflash.com/api/...). The image service resolves these paths internally and will return a 500 error if given an external URL.

Typical workflow:

  1. Generate an image with POST / (text-to-image)
  2. Retrieve its output_image_url from GET /history
  3. Pass that relative path in image_urls to POST /edit
curl -X POST "https://app.neuroflash.com/api/ds-prototypes/edit" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-workspace-id: YOUR_WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"prompt": "string",
"num_images": 1,
"aspect_ratio": "string",
"output_format": "string",
"model": {},
"image_urls": ["/api/ds-prototypes/image_generation/YOUR_IMAGE_ID/view"],
"limit_generations": false
}'

Response:

{
"images": [
{
"url": "string",
"content_type": "string",
"file_name": {},
"file_size": {},
"width": {},
"height": {},
"image_id": {}
}
],
"description": "string",
"prompt": "string",
"detail": {},
"batch_id": {}
}

Get Available Models

GET/models

Get list of available image generation models.

Returns static list of configured models with allowed flag based on user permissions.

Example

curl "https://app.neuroflash.com/api/ds-prototypes/models" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-workspace-id: YOUR_WORKSPACE_ID"

Response:

[
{
"id": "string",
"name": "string",
"provider": "string",
"description": "string",
"capabilities": [
"string"
],
"max_images": 0,
"aspect_ratios": [
"string"
],
"output_formats": [
"string"
],
"allowed": false,
"order": 0
}
]

Get Generation History

GET/history

Get image generation history for the authenticated user's workspace.

Args: model: Optional filter by model name (e.g., "nano-banana") limit: Maximum number of results (default 100, max 1000) offset: Offset for pagination (default 0)

Returns: List of generation history entries

Query Parameters

ParameterTypeDefaultDescription
modelstring
limitinteger100
offsetinteger0

Example

curl "https://app.neuroflash.com/api/ds-prototypes/history" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-workspace-id: YOUR_WORKSPACE_ID"

Response:

[
{
"output_image_id": "string",
"batch_id": "string",
"user_id": 0,
"workspace_id": "string",
"prompt": "string",
"model": "string",
"parameters": {},
"input_images": {},
"output_image_url": "/api/ds-prototypes/image_generation/b64b61f6-a7d2-4fa0-9f88-289dae46c41f/view",
"output_image_width": {},
"output_image_height": {},
"output_image_size": {},
"created_at": "2024-01-15T10:30:00Z"
}
]

Get Generation By Id

GET/history/{image_id}

Get a specific generation by its image ID.

Args: image_id: The output image ID (also the generation ID)

Returns: Generation history entry

Path Parameters

ParameterTypeRequiredDescription
image_idstringYes

Response

FieldTypeDescription
output_image_idstring
batch_idstring
user_idinteger
workspace_idstring
promptstring
modelstring
parametersobject
input_imagesobject
output_image_urlobject
output_image_widthobject
output_image_heightobject
output_image_sizeobject
created_atstring

Example

curl "https://app.neuroflash.com/api/ds-prototypes/history/{image_id}" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-workspace-id: YOUR_WORKSPACE_ID"

Response:

{
"output_image_id": "string",
"batch_id": "string",
"user_id": 0,
"workspace_id": "string",
"prompt": "string",
"model": "string",
"parameters": {},
"input_images": {},
"output_image_url": {},
"output_image_width": {},
"output_image_height": {},
"output_image_size": {},
"created_at": "2024-01-15T10:30:00Z"
}

Delete Generation

DELETE/history/{image_id}

Delete a generation and its associated image from storage.

Args: image_id: The output image ID (generation ID) to delete

Returns: Success message

Path Parameters

ParameterTypeRequiredDescription
image_idstringYes

Example

curl -X DELETE "https://app.neuroflash.com/api/ds-prototypes/history/{image_id}" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "x-workspace-id: YOUR_WORKSPACE_ID"

Response:

{}