Stable Image Core API Introduction

Our primary service for text-to-image generation, Stable Image Core represents the best quality achievable at high speed. No prompt engineering is required! Try asking for a style, a scene, or a character, and see what you get.

Credits

The service uses 6 credits per successful result. You will not be charged for failed results.

Example Request and Response

API Documentation

API EndpointMethod
/api/generate/corePOST

Request Header

ParameterDescription
AuthenticationUse your API key to authentication requests to this App.

Request Body

The request should include a JSON object in the body with the following parameters:

ParameterTypeRequiredDescription
promptstringYes

The text description or prompt used to generate the image.

widthintYes

The desired pixel width for the generated image should be between 320 and 1536 pixels, in an increment divisible by 64.

heightintYes

The desired pixel height for the generated image should be between 320 and 1536 pixels, in an increment divisible by 64.

aspect_ratiostringNo

Enum: 16:9 1:1 21:9 2:3 3:2 4:5 5:4 9:16 9:21

Default: 1:1

Controls the aspect ratio of the generated image.

seedinitNo

Random noise seed (omit this option or use 0 for a random seed).

negative_promptstringNo

Keywords of what you do not wish to see in the output image. This is an advanced feature.This parameter does not work with sd3-large-turbo.

style_presetstringNo

Enum: 3d-model analog-film anime cinematic comic-book digital-art enhance fantasy-art isometric line-art low-poly modeling-compound neon-punk origami photographic pixel-art tile-texture

Pass in a style preset to guide the image model towards a particular style. This list of style presets is subject to change.

Response Body

The response should include a JSON object in the body with the following parameters:

ParameterTypeDescription
codeintStatus Code, 0 for success callback, -1 for failure callback
messagestringCallback message, 'success' for success, failure reason for failure
dataobjectImage Details

Image Details

ParameterTypeDescription
imagestringReturn the base64 encoded image of the generated picture.
seedintThe seed used as random noise for this generation.

Example Request

import requests
import json
import base64

data = {
    'prompt': 'A lighthouse on a cliff',
    'height': 1024,
    'width': 1024,
}

url = "https://www.aithriving.com/api/generate/core"
headers = {
    'Accept': 'application/json',
    'Authorization': 'your-auth-token',
}

response = requests.post(url, json=data, headers=headers)

response_json = response.json()
if response_json.get('code') == 0:
    image_data = base64.b64decode(response_json['data']['image'])
    with open("./result.png", 'wb') as file:
        file.write(image_data)

Example Response

{
  "code": 0,
  "message": "success",
  "data": {
    "image": "base64 encoded image data",
    "seed": 1050625087
  }
}