Image Generation

Overview

Our Image Generation API creates images based on text prompts. These images can be generated in many styles, including photographs, paintings, drawings, and graphics. The number of images generated per prompt is specified as a parameter when calling the API and can be up to six. The price for an API call depends on the number of images that were generated for that call (for more information on pricing, contact our sales team at [email protected]).

In addition to the main text prompt, the API also takes an optional negative prompt as input. Negative prompts describe what subjects or qualities one does not want to appear in the generated images. This feature allows for further creative control over the images produced by the model.

Before returning any set of images, we first run those images through our visual moderation model in order to prevent violent, sexually explicit, or otherwise harmful results. If the generated images do not pass this moderation step, the API call will fail and an error message will be returned in place of a normal response.

Request Format

The input fields for this API are as follows:

text_data: The main text prompt. This describes what the image should include.
neg_text: An optional negative text prompt. This describes what the image should exclude.
num_images: The number of images you want to generate for this prompt.
callback_url: If the task is completed, we will send a callback from our servers to this callback url.

In full, a request to our Image Generation API follows the following format:

curl --location --request POST 'https://api.thehive.ai/api/v2/task/async' \
--header 'authorization: Token <YOUR_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "options": {
    "neg_text": "grass, pool",
    "num_images": 3
  },
  "text_data": "modern architecture house",
  "callback_url": "example_url"
}'

Response

The output of our Image Generation API consists of links the resulting generated images. Each image is 1024x1024. To see an annotated example of an API response object for this model, you can visit our API reference page.