The API uses account credits just like the web interface. See section below for 'Create a new fine-tune' for development purposes using branch=fast. Once you're ready for production, you can purchase credits and adjust the quantity on the checkout page to how much you need.

Buy creditsBuy bulk $3 - min 200 fine-tunes

Fair use

Current limit is 14 prompts per fine-tune on average, each prompt generating 8 images. Total 112 images on average. There are no exceptions. Some apps claim to provide 100 avatars - meaning ~100 images.

The API was built with the idea that users type prompts manually and authentically. We additionally accounted for 7 automatic prompts that might be added by the system to ease the user and get users acquainted with the system.

We urge app builders against commoditization of the system. Most people would not be able to mentally process 100 images, and this might make the service look cheap.

Consider instead providing a custom unique experience: Let the user choose amongst a few styles/prompts/themes. Consider allowing the user to enter prompts but then augment those with some clever prompt engineering (e.g: or maybe allow them to search by keyword through Lexica or other API (e.g: and adjust the prompt with the `sks class_name` for them.


Astria uses Authorization header to authenticate requests. You can get an API key in your account page.

Generate API Key


Experimental Postman collection is available here. Note that the automatic code generation is not optimal and is missing headers like Authorization and Content-Type.

Postman collection

Tune resource

Get a list of all fine-tunes

curl -X GET -H "Authorization: Bearer $API_KEY"[...array of finetunes...]

Create a new fine-tune

If you would like to experiment with the API for testing purposes free, use branch=fast - This is will return hard-coded prompt results within a minute

callback is a URL that will be called when the fine-tune is done processing. The callback is a POST request where the body contains the tune object. Once the fine-tune is done processing, prompts will start processing.

steps - training steps is also an optional parameter which we recommend leaving out in order to allow better defaults set by the system.

Note this request is a multi-part encoded form request, i.e: not JSON

Example with NodeJS/Javascript
import FormData from 'form-data';
import fs from 'fs';
import fetch from "node-fetch";

const API_KEY = 'sd_XXXX';
const DOMAIN = '';

function createTune() {
  let formData = new FormData();
  formData.append('tune[title]', 'John Smith');
  formData.append('tune[branch]', 'fast');
  formData.append('tune[name]', 'man');
  // Load all JPGs from ./samples directory and append to FormData
  let files = fs.readdirSync('./samples');
  files.forEach(file => {
    formData.append('tune[images][]', fs.createReadStream(`./samples/${file}`), file);
  formData.append('tune[callback]', '');

  let options = {
    method: 'POST',
      headers: { 'Authorization': 'Bearer ' + API_KEY },
      body: formData
  return fetch(DOMAIN + '/tunes', options)
    .then(r => r.json())
Example with cURL
curl -X POST -H "Authorization: Bearer $API_KEY" \
          -F tune[callback]="" \
          -F tune[title]="my portrait" \
          -F tune[branch]="" \
          -F tune[name]=man \
          -F "tune[images][][email protected]" \
          -F "tune[images][][email protected]" \
          -F "tune[images][][email protected]" \
          -F "tune[images][][email protected]"
Example with cURL with image_urls
curl -X POST -H "Authorization: Bearer $API_KEY" \
          -F tune[callback]="" \
          -F tune[title]="grumpy cat" \
          -F tune[branch]="" \
          -F tune[name]=cat \
          -F "tune[image_urls][]=" \
          -F "tune[image_urls][]=" \
          -F "tune[image_urls][]=" \
          -F "tune[image_urls][]="
{ "id": 1, "images": [ "", "", "", "" ], "name": "person", "steps": null, "ckpt_url": null, "created_at": "2022-10-06T14:06:09.088Z", "updated_at": "2022-10-06T14:06:09.139Z", "url": "" }

Get one fine-tune

Note that ckpt_url is only available after the fine-tune is done processing, and is a pre-signed URL which expires after 60 minutes.

curl -X GET -H "Authorization: Bearer $API_KEY"{
  "id": 1,
  "images": [
  "name": "man",
  "steps": null,
  "ckpt_url": "https://....",
  "created_at": "2022-10-06T14:06:09.088Z",
  "updated_at": "2022-10-06T14:06:09.139Z",
  "url": ""

Delete one fine-tune

curl -X DELETE -H "Authorization: Bearer $API_KEY"

Prompt resource

Create a new prompt

callback is a URL that will be called when the prompt is done processing. The callback is a POST request where the body contains the prompt object.

Note that you can control `cfg_scale`, `seed`, `steps` as well, however #{Settings.site_name) provides some good defaults for these.

curl -X POST -H "Authorization: Bearer $API_KEY" \ -F prompt[text]="a painting of sks man in the style of alphonse mucha" \ -F prompt[callback]=""{ "id": 29, "callback": "", "text": "a painting of sks man in the style of alphonse mucha", "negative_prompt": "3 legs, 4 legs", "cfg_scale": null, "steps": null, "seed": null, "trained_at": null, "started_training_at": null, "created_at": "2022-10-06T16:12:54.505Z", "updated_at": "2022-10-06T16:12:54.505Z", "tune_id": 26, "url": "" }

Get all prompts of a fine-tune

Use the offset parameter to paginate through the results.

curl -X GET -H "Authorization: Bearer $API_KEY"[...array of prompts...]