Running a model
KreaIn the appsText to imageKrea 2 Turbo
A prompt, a style and an aspect ratio in. A finished image out.
One of the models behind Auray's apps, under the auray-ai/ namespace.
Its request shape is published below. Whether it runs right now is GET /v1/catalogue's word, with no key needed: its addresses say connected for an address that runs, and a submit to any other is refused before anything is charged — described answers 501 model_not_connected, paused 503 model_disabled.
Category text-to-image · Scope image:write (or photo:write on an older key) · Price A flat base per job plus a rate per image, set by the resolution; GET /v1/plans serves each figure in force as price_keys (photo.base, photo.per_image.<resolution>), and the submit quotes the credits it charges on success.
#Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | yes | — | What to make. Up to 4,000 characters, and the model reads 507 tokens of its own tokenizer — about 2,000 characters of English, 1,400 of Indonesian — with a style's trigger phrase counted. Past either, the request is refused with prompt_too_long before anything is charged; a refusal in tokens carries tokens and max_tokens. Documented range: up to 4,000 characters. |
aspect_ratio | string | yes | — | The shape of the image. One of "1:1", "4:3", "3:4", "16:9", "9:16", "3:2", "2:3". |
resolution | integer | yes | — | The size of the image. 1024 is about one megapixel at every shape: 1024×1024 (1:1), 1152×896 (4:3), 896×1152 (3:4), 1344×768 (16:9), 768×1344 (9:16), 1216×832 (3:2), 832×1216 (2:3). 2048 is 2048 on the long edge: 2048×2048 (1:1), 2048×1600 (4:3), 1600×2048 (3:4), 2048×1152 (16:9), 1152×2048 (9:16), 2048×1408 (3:2), 1408×2048 (2:3). One of 1024, 2048. |
num_images | integer | no | 1 | How many to render in one job. Each is charged. One of 1, 2, 3, 4. |
style | string | no | — | A style adapter, or null for the base model. Its trigger phrase is joined server-side. One of "retroanime", "sunsetblur", "vintagetarot", "rainywindow", "darkbrush", "dotmatrix", "neondrip", "kidsdrawing", "softwatercolor", null. May be null. |
seed | integer | no | — | Omit for a random one. The same seed and settings reproduce an image. |
idempotency_key | string | no | — | Your own name for this request. Send the same one twice and the second call is answered with the first request rather than charged again. Idempotency-Key: as a header is accepted as an alias — that is the spelling a retrying proxy replays, and the one to use when running a model on auray.run, where a request that outlives its connection is answered 504 and recovered by replay. Omit it and the platform mints one. 1 to 64 characters. |
#Example
curl -X POST https://queue.auray.run/auray-ai/krea-2-turbo/text-to-image \
-H "Authorization: Bearer $AURAY_API_KEY" \
-H "content-type: application/json" \
-d '{
"prompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"aspect_ratio": "1:1",
"resolution": 1024
}'import { createClient } from "@auray/client";
const auray = createClient(); // reads AURAY_API_KEY
const result = await auray.subscribe("auray-ai/krea-2-turbo/text-to-image", {
input: {
"prompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"aspect_ratio": "1:1",
"resolution": 1024
},
onQueueUpdate: (update) => console.log(update.status),
});
console.dir(result, { depth: null });from auray_client import Client
auray = Client() # reads AURAY_API_KEY
result = auray.subscribe(
"auray-ai/krea-2-turbo/text-to-image",
input={
"prompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"aspect_ratio": "1:1",
"resolution": 1024
},
on_queue_update=lambda update: print(update["status"]),
)
print(result){
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "run_model",
"arguments": {
"address": "auray-ai/krea-2-turbo/text-to-image",
"input": {
"prompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"aspect_ratio": "1:1",
"resolution": 1024
}
}
}
}const res = await fetch("https://queue.auray.run/auray-ai/krea-2-turbo/text-to-image", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AURAY_API_KEY}`,
"content-type": "application/json",
},
body: JSON.stringify({
"prompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"aspect_ratio": "1:1",
"resolution": 1024
}),
});
console.log(await res.json());import os, requests
r = requests.post(
"https://queue.auray.run/auray-ai/krea-2-turbo/text-to-image",
headers={"Authorization": f"Bearer {os.environ['AURAY_API_KEY']}"},
json={
"prompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"aspect_ratio": "1:1",
"resolution": 1024
},
)
r.raise_for_status()
print(r.json())package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := []byte(`{
"prompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"aspect_ratio": "1:1",
"resolution": 1024
}`)
req, err := http.NewRequest("POST", "https://queue.auray.run/auray-ai/krea-2-turbo/text-to-image", bytes.NewReader(body))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("AURAY_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(res.Status, string(out))
}<?php
$ch = curl_init("https://queue.auray.run/auray-ai/krea-2-turbo/text-to-image");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("AURAY_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"prompt" => "a brass orrery on a walnut desk, morning light from a window to the left",
"aspect_ratio" => "1:1",
"resolution" => 1024,
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), " ", $response, PHP_EOL;require "net/http"
require "json"
uri = URI("https://queue.auray.run/auray-ai/krea-2-turbo/text-to-image")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV.fetch("AURAY_API_KEY")}"
req["Content-Type"] = "application/json"
req.body = {
"prompt" => "a brass orrery on a walnut desk, morning light from a window to the left",
"aspect_ratio" => "1:1",
"resolution" => 1024
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.code, res.bodyimport java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String body = """
{
"prompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"aspect_ratio": "1:1",
"resolution": 1024
}""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://queue.auray.run/auray-ai/krea-2-turbo/text-to-image"))
.header("Authorization", "Bearer " + System.getenv("AURAY_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}using System.Net.Http.Headers;
using System.Text;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("AURAY_API_KEY"));
using var request = new HttpRequestMessage(HttpMethod.Post, "https://queue.auray.run/auray-ai/krea-2-turbo/text-to-image");
var body = """
{
"prompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"aspect_ratio": "1:1",
"resolution": 1024
}
""";
request.Content = new StringContent(body, Encoding.UTF8, "application/json");
using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");The same body on https://auray.run runs synchronously and answers the result — unless it usually takes longer than a run may hold its connection, which is refused 400 model_not_synchronous before anything is charged. Options — ?webhook=, ?wait=, priority and timeout headers — are on Submit a request.
#Machine contracts
- openapi.json — this page as an OpenAPI 3.1 document, public.
- llms.txt — the same, written for an agent.
