Nebula Block
  • Overview
  • Getting Started
    • Quickstart
    • Account Setup
    • Billing Information
    • Deploy Products
  • Core Services
    • Inference Models
      • Text Generation
      • Text Generation (Vision)
      • Image Generation
      • Embedding Generation
      • Model List
    • GPU Instances
      • Quickstart
    • Object Storage
      • Get Started
      • Tutorials
        • Linux/Mac
        • Windows
      • SDK
        • Golang
        • Python
        • Java
    • SSH Keys
      • Quickstart
  • API Reference
    • Platform API
      • Authentication
      • Instances
        • List Products
        • Create GPU Instance
        • List User Instances
        • List Deleted User Instances
        • User Instance Detail
        • Delete GPU Instance
        • Start GPU Instance
        • Stop GPU Instance
        • Reboot GPU Instance
      • SSH Keys
        • List SSH Keys
        • Rename SSH Key
        • Delete SSH Key
      • API Keys
        • List API Keys
        • Delete API Key
      • Billing
        • List Invoices
        • Download Invoice
        • Get Payment History
    • Inference API (OpenAI Compatible)
      • List Models
      • Generate Text
      • Generate Text (Vision)
      • Generate Images
      • Generate Embeddings
  • Team
  • Tier
  • Referral
  • Glossary
  • Contact Us
Powered by GitBook
On this page
  • HTTP Request
  • Response Attributes
  • Example
  1. API Reference
  2. Inference API (OpenAI Compatible)

Generate Images

Generate Images.

PreviousGenerate Text (Vision)NextGenerate Embeddings

Last updated 21 days ago

Return the generated image based on the given inputs.

HTTP Request

POST {API_URL}/images/generation

where API_URL = https://api.nebulablock.com/api/v1. For more details on the parameters, see the section.

Response Attributes

model string

The specific AI model used to generate the response.

object string

The type of the data.

data list

A list of dictionaries containing the generated image data. Each dictionary contains the following fields:

  • timings dict: Contains the time taken for inference.

    • inference float: The time taken for inference in seconds.

  • index integer: The index of the generated image (if more than 1 image is generated).

  • b64_json string: The base64-encoded JSON data of the generated image.

message string

A message indicating the status of the request.

status string

The status of the request.

Example

Request

Text-to-Image Generation

curl -X GET '{API_URL}/api/v1/images/generation' \
-H 'Authorization: Bearer {TOKEN/KEY}' \
-H 'Content-Type: application/json' \
-d '{
    "model": "stabilityai/stable-diffusion-xl-base-1.0",
    "prompt": "insert your prompt here",
    "num_steps": 25,
    "guidance_scale": 9,
    "width": 1024,
    "height": 1024,
    "negative_prompt": null
}'

Image-to-Image Generation

curl -X POST "https://api.nebulablock.com/api/v1/images/generation" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $NEBULA_API_KEY" \
    --data-raw '{
    "model":"black-forest-labs/FLUX.1-Fill-dev",
    "prompt": "a red baseball cap",
    "num_steps": 40,
    "guidance_scale": 4.5,
    "width": 1024,
    "height": 1024,
    "image": "/9j/4…/Z", 
    "mask": "/9j/4…ACgD/9k="
}'

Response

Here's an example of a successful response. Note that you need to decode the b64 json data with a decoder of your choice to see the image.

{
    "model": "black-forest-labs/FLUX.1-schnell",
    "object": "list",
    "data": [
        {
            "timings": {
                "inference": 13.366829872131348
            },
            "index": 0,
            "b64_json": "sdj23kjjk2..."
        }
    ],
    "message": "Image generated successfully",
    "status": "success"
}

For more examples, see the section.

Inference Models
Inference Models