Image Generation Model APIs
A guide to our image generation models
Note: The information on this page applies to customers on our deprecated v2 APIs for image generation. Customers on our v3 APIs should refer to the updated v3 docs for image generation.
Overview
Our image generation models create images based on text prompts. A maximum of six images can be generated per prompt. When a user makes an API request with this model, the response consists of links to each generated image and information about its dimensions.
Before generating any images, we first run the prompt through our text moderation model. If the prompt is flagged, the model does not proceed with image generation and an error message will be returned. If the prompt is not flagged, we run the subsequent generated images through our visual moderation model in order to prevent violent, sexually explicit, or otherwise harmful results. Images will not be returned if they are flagged for any of the following moderation categories: NSFW, nudity, and blood. If any of the generated images for a given prompt are flagged during this moderation process, the API call will fail and an error message will be returned in place of a normal response.
Models
We have four different image generation models available, with additional models to be served in the near future. Our current lineup consists of: SDXL (Stable Diffusion XL), SDXL Enhanced, Flux Schnell, and Flux Schnell Enhanced. SDXL Enhanced and Flux Schnell Enhanced are Hive’s enhanced versions of the aforementioned base models, served exclusively to our customers.
Here are the differences between our current model offerings:
Model | Description |
---|---|
SDXL (Stable Diffusion XL) | Stability AI's flagship model for artistic image generation, offering versatile and high-quality visuals for creative projects. |
SDXL Enhanced | Trained by Hive and served exclusively to our customers, this model specializing in portraits, creatures, and landscapes, and delivers a wide range of unique styles for your artistic needs. |
Flux Schnell | The fastest image generation model from Black Forest Labs, ideal for personal or commercial use. Create stunning visuals with detailed text prompts. |
Flux Schnell Enhanced | Trained by Hive and served exclusively to our customers, this model elevates Flux's capabilities to deliver high-fidelity, photorealistic images with lifelike quality. Retains Flux base's speed and efficiency, while leading to higher levels of customer satisfaction based on past user studies. |
Emojis | Create custom, high-quality emojis with transparent backgrounds, perfect for branding, messaging, or creative applications. |
Request Format
Below are the input fields for an image generation cURL request. The asterisk (*) next to an input field designates that it is required.
text_data
*: The text prompt the model uses for image generation.
neg_text
: Text prompt where the user can detail aspects that should not be included in the generated image.
num_images
: The number of images to generate per request. The default value is 2, with a range of 1 to 6, inclusive.
callback_url
: When the task is completed, we will send a callback from our servers to this callback url.
Here is an example of a cURL request using 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
After making an image generation model cURL request, you will receive a response consisting of links to the resulting generated images. To see an example API response for this model, you can visit our API reference page.
Content Moderation
Content moderation is enabled by default on all of our image generation models. When a request is made to our image generation models, it gets passed through two moderation filters. First, the prompt is run through our text moderation model. If the prompt gets flagged, image generation will not occur. If the prompt does not get flagged, the resulting generated images are run through our visual classification model.
If the image generated does not meet our guidelines for text or visual moderation, the task will not be charged, and the following message will be returned.
{ "return_code": 451, "message": "Images did not pass moderation filters.” }
Updated 3 days ago