IMAGINE Stable Diffusion XL Conversational API Documentation

Welcome to our API documentation. Here you'll find all the information needed to integrate and work with our services.

Setting up

To communicate with our API, you need an API key. For new users there is a free use of $2 upon register. So try our API for free!

Your API Key

Please log in or register via the chat to get your API key.

Your budget

Your budget is n/a for now.

To add budget, please contact us, because we're working very hard on the online payment to get up asap.

Log in to see your budget and more.

Pricing

This is the pricing for the API, charged by request. Do you look for pricing of the online chat application? Look here for the chat plans.

API EndpointPrice per Image
IMAGINE Stable Diffusion XL Conversational$0.01
Additional Images in IMAGINE Context$0.005
Classic Stable Diffusion XL*$0.009
Upscale SDXL + Refiner*$0.002
SDXL Conversational, Low Resolution, No-PriorityFree
IMAGINE-GPT*$0.00025

* coming very soon

If you want to read more about our Stable Diffusion XL API and see some examples, head over to the Trooper.AI Website and read more about the cool Benefits of our API: https://www.trooper.ai/en/stable-diffusion-api

Endpoints

All API endpoints going to domain: https://imagine.trooper.ai

POST /api/v1/chat2img

Use this endpoint to turn descriptions into images. Leave 'chatId' empty for new images, and we'll detect if it's new otherwise.

For 'message_or_prompt', write descriptions like 'A cute dog in a garden' or commands like 'change dog to cat' or 'generate variant'.

Request

{ "message_or_prompt": "Generate variant", "chatId": "f78aef3a-7110-5e74-b833-f72cd6a29275", "key": "[YOUR_TROOPER_API_KEY]" }

The return will always include a chatId. This chatId could be:

  • Yours, if the image is the same or a variant of a previous one.
  • A new one, either because you requested a new image or we detected a new image request.

Check the intent value to understand our detection of the user's request:

  • UPDATE_SCENE: Indicates a change request for a scene description or something similar.
  • NEW_SCENE: Indicates a complete change, a deletion, or a new prompt request.
  • GET_VARIANT: Request for a different version of the same scene. Examples include requests like 'get variant', 'variant', 'alternative image', 'change perspective', or 'different view'.
  • NOT_CLEAR: Used only if the request is ambiguous, not straightforward, or doesn't fit any of the other categories.

Additionally, you will receive message texts from the agent. You can choose to present these to your users or disregard them.

Response

{ "imageUrl": "https://cdn-imagine.trooper.cloud/imageresult/37ab747c-6ea0-5a37-b461-2c479d18269e.jpg", "intent": "GET_VARIANT", "chatId": "f78aef3a-7110-5e74-b833-f72cd6a29275", "msg_texts": [ "I make you an alternative photo ... 😇 Please wait." ] }