Documentation
  • Quick Start
  • Models
    • Block Entropy Models
    • Block Entropy Image Generation
    • Avatars
    • Smart Routing
    • Routing through Openrouter
    • Block Entropy Embeddings
  • Generation
    • Chat Completions
    • Structured Generation
    • Image generation
      • Usage
      • API Reference
    • Text-to-speech
  • Guides
    • Open Web UI
    • Silly Tavern
      • Connecting to Silly Tavern
      • Story Image Generation
    • Danswers
  • Depreciations
Powered by GitBook
On this page
  • Image Generation
  • Request body
  • Returns
  • Image Editing
  • Request body
  • Returns
  1. Generation
  2. Image generation

API Reference

Image Generation

Creates an image given a prompt.

POST https://api.blockentropy.ai/v1/images/generations

Request body


prompt string Required

A text description of the desired image. The maximum length is - characters.


model string Optional Defaults to SD-XL 1.0-base

The model to use for image generation.


n integer

The value used to seed the model generator.


quality string Optional Defaults to smooth

The quality of the image that will be generated.


response_format string or null Optional Defaults to url

The format in which the generated images are returned. Must be one of url or b64_json. URLs are only valid for 60 minutes after the image has been generated.

size string or null Optional Defaults to 1024x1024

The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.

Returns

Returns a list of image objects.

Example request
from openai import OpenAI

be_api_key= "BE_API_KEY"
base_url='https://api.blockentropy.ai/v1'
model="be-stable-diffusion-xl-base-1.0"

client = OpenAI(
    base_url=base_url,
    api_key=be_api_key
)

client.images.generate(
  model=model,
  prompt="A cute baby sea otter",
  n=1,
  size="1024x1024"
)
Response
{
  "created": 1589478378,
  "data": [
    {
      "url": "https://..."
    }
  ]
}

Image Editing

Creates an edited version of an image given an original image and a prompt.

POST https://api.blockentropy.ai/v1/images/edits

Request body


image file Required

The image file to edit or use as a reference for pose estimation. Must be valid PNG file.


prompt string Required

A text description of the desired image. The maximum length is - characters.


model string Optional Defaults to SD-XL 1.0-base

The model to use for image generation.


n integer

The value used to seed the model generator.


quality string Optional Defaults to smooth

The quality of the image that will be generated.


response_format string or null Optional Defaults to url

The format in which the generated images are returned. Must be one of url or b64_json. URLs are only valid for 60 minutes after the image has been generated.

size string or null Optional Defaults to 1024x1024

The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.

user string Optional

An optional parameter must be set to cn when the user wants to use the endpoint for pose estimation.

Returns


Returns a list of image objects.

Example Request
from openai import OpenAI

be_api_key= "BE_API_KEY"
base_url='https://api.blockentropy.ai/v1'
model="be-stable-diffusion-xl-base-1.0"

client = OpenAI(
    base_url=base_url,
    api_key=be_api_key
)

client.images.edit(
  image=open("otter.png", "rb"),
  prompt="A cute baby sea otter wearing a beret",
  n=2,
  size="1024x1024"
)
Response
{
  "created": 1589478378,
  "data": [
    {
      "url": "https://..."
    }
  ]
}
PreviousUsageNextText-to-speech

Last updated 10 months ago