Running a model
Black Forest LabsText to imageBlack Forest Labs FLUX.1 [schnell]
Ultra fast FLUX.1 text to image model for local use
One of Auray's catalogue models: the same key, the same credits, the same job lifecycle as every other address.
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 external:write on an older key) · Price Credits per megapixel (counted as width*height*steps+ultralytics.steps@24): 0.1908. From 0.2622 to 34.9526 megapixels a request. Quoted when you submit, at the most the request can cost; the charge settles to what the job cost and never above the quote. The submit's answer carries the quote as credits_quoted, and credits_charged says what has been taken.
#Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
inputs | object | no | — | |
inputs.seedImage | string | no | — | Image used as a starting point for the generation (an http(s) URL; upload a local file first and send its read URL). A URL. |
inputs.maskImage | string | no | — | Image used to specify which areas of the input image should be edited (an http(s) URL; upload a local file first and send its read URL). White marks the area to edit, black is preserved. A URL. |
positivePrompt | string | yes | — | Text prompt describing elements to include in the generated output. Documented range: 2 to 3,000 characters. |
negativePrompt | string | no | — | Prompt to guide what to exclude from generation. Ignored when guidance is disabled (CFGScale ≤ 1). Documented range: 2 to 3,000 characters. |
width | integer | yes | 1536 | Width of the generated media in pixels. Documented range: 128 to 2,048. |
height | integer | yes | 1024 | Height of the generated media in pixels. Documented range: 128 to 2,048. |
seed | integer | no | — | Random seed for reproducible generation. When not provided, a random seed is generated in the unsigned 32-bit range. Documented range: 0 to 9,223,372,036,854,776,000. |
steps | integer | no | 4 | Total number of denoising steps. Higher values generally produce more detailed results but take longer. Documented range: 1 to 100. |
scheduler | string | no | — | Scheduler to use for the diffusion process. One of "DDIM", "DDIMScheduler", "DDPMScheduler", "DEISMultistepScheduler", "Default", "DPM++", "DPM++ 2M", "DPM++ 2M Beta", "DPM++ 2M Exponential", "DPM++ 2M Karras", "DPM++ 2M SDE", "DPM++ 2M SDE Beta", "DPM++ 2M SDE Exponential", "DPM++ 2M SDE Karras", "DPM++ 2M SDE Uniform", "DPM++ 2M Uniform", "DPM++ 3M", "DPM++ 3M Beta", "DPM++ 3M Exponential", "DPM++ 3M Karras", "DPM++ 3M SDE Uniform", "DPM++ 3M Uniform", "DPM++ Beta", "DPM++ Exponential", "DPM++ Karras", "DPM++ SDE", "DPM++ SDE Beta", "DPM++ SDE Exponential", "DPM++ SDE Karras", "DPM++ Uniform", "DPM++ Uniform Beta", "DPM++ Uniform Exponential", "DPM++ Uniform Karras", "DPMSolverMultistepInverse", "DPMSolverMultistepScheduler", "DPMSolverSinglestepScheduler", "EDMDPMSolverMultistepScheduler", "EDMEulerScheduler", "Euler", "Euler a", "Euler Beta", "Euler Exponential", "Euler Karras", "EulerAncestralDiscreteScheduler", "EulerDiscreteScheduler", "FlowMatchEulerDiscreteScheduler", "Heun", "HeunDiscreteScheduler", "Heun Karras", "IPNDMScheduler", "IPNDM Uniform", "IPNDM Uniform Beta", "IPNDM Uniform Exponential", "IPNDM Uniform Karras", "KDPM2AncestralDiscreteScheduler", "KDPM2DiscreteScheduler", "LCM", "LCMScheduler", "LMS", "LMSDiscreteScheduler", "LMS Karras", "PNDMScheduler", "TCDScheduler", "UniPC", "UniPC 2M", "UniPC 2M Karras", "UniPC 2M Uniform", "UniPC 3M", "UniPC 3M Karras", "UniPC 3M Uniform", "UniPC Karras", "UniPC Uniform", "UniPC Uniform Beta", "UniPC Uniform Exponential", "UniPC Uniform Karras". |
CFGScale | number | no | — | Guidance scale representing how closely the output will resemble the prompt. Higher values produce results more aligned with the prompt. Documented range: 0 to 20. |
strength | number | no | 0.8 | Strength of the transformation. Lower values result in more influence from the original input. Documented range: 0 to 1. |
maskMargin | integer | no | — | Extra context pixels around the masked region during inpainting. The model zooms into the masked area with these additional pixels for better integration. Documented range: 32 to 128. |
promptWeighting | string | no | — | Defines the syntax to be used for prompt weighting. Prompt weighting allows you to adjust how strongly different parts of your prompt influence the generated image. Choose between compel notation with advanced weighting operations or sdEmbeds for simple emphasis adjustments. Compel syntax: Adds 0.2 seconds to image inference time. When compel syntax is selected, you can use the following notation in prompts: Weighting Syntax: + - (word)0.9 Increase or decrease the attention given to specific words or phrases. Examples: - Single words: small+ dog, pixar style - Multiple words: small dog, (pixar style)- - Multiple symbols for more effect: small+++ dog, pixar style - Nested weighting: (small+ dog)++, pixar style - Explicit weight percentage: small dog, (pixar)1.2 style Blend Syntax: .blend() Merge multiple conditioning prompts. Example: ("small dog", "robot").blend(1, 0.8) Conjunction Syntax: .and() Break a prompt into multiple clauses and pass them separately. Example: ("small dog", "pixar style").and() SdEmbeds syntax: When sdEmbeds syntax is selected, you can use the following notation in prompts: Weighting Syntax: (text) (text:number) [text] Use parentheses () to increase attention, square brackets [] to decrease it. Add a number after the text to specify a custom multiplier. Examples: - Single words: (small) dog, pixar style - Multiple words: small dog, [pixar style] - Higher emphasis: (small:2.5) dog, pixar style - Combined emphasis: (small dog:1.5), pixar style One of "sdEmbeds". |
acceleratorOptions | object | no | — | |
acceleratorOptions.cacheEndStep | integer | no | — | Absolute step number to end caching. Must be greater than cacheStartStep and less than or equal to steps. Documented range: 1 or more. |
acceleratorOptions.cacheEndStepPercentage | integer | no | — | Percentage of steps to end caching. Alternative to cacheEndStep. Must be greater than cacheStartStepPercentage. Documented range: 1 to 100. |
acceleratorOptions.cacheMaxConsecutiveSteps | integer | no | 3 | Limits the maximum number of consecutive steps that can use cached computations before forcing a fresh computation. Documented range: 1 to 5. |
acceleratorOptions.cacheStartStep | integer | no | — | Absolute step number to start caching. Must be less than cacheEndStep. Documented range: 0 or more. |
acceleratorOptions.cacheStartStepPercentage | integer | no | — | Percentage of steps to start caching. Alternative to cacheStartStep. Must be less than cacheEndStepPercentage. Documented range: 0 to 99. |
acceleratorOptions.fbCache | boolean | no | — | First Block Cache (FBCache) acceleration. Reuses feature block computations across steps. |
acceleratorOptions.fbCacheThreshold | number | no | 0.25 | Controls the sensitivity threshold for determining when to reuse cached computations. Lower values reuse more aggressively. Documented range: 0 to 1. |
acceleratorOptions.teaCache | boolean | no | — | TeaCache acceleration for transformer-based models. Estimates step differences to skip redundant computations. |
acceleratorOptions.teaCacheDistance | number | no | 0.5 | Controls the aggressiveness of the TeaCache feature. Lower values prioritize quality, higher values prioritize speed. Documented range: 0 to 1. |
acceleratorOptions.dbCache | boolean | no | — | DB Cache (CacheDiT) acceleration. Caches and reuses intermediate transformer block outputs to skip redundant computations. |
acceleratorOptions.dbCacheThreshold | number | no | 0.25 | Controls the sensitivity threshold for DB Cache. Lower values reuse cached blocks more aggressively, higher values prioritize quality. Documented range: 0 to 1. |
acceleratorOptions.dbCacheSkipInterval | integer | no | 5 | Controls how many steps to skip between cache refreshes. Higher values skip more steps for faster generation at the cost of quality. Documented range: 1 or more. |
outpaint | object | no | — | |
outpaint.top | integer | no | — | Number of pixels to extend to the top. Documented range: 0 or more. |
outpaint.bottom | integer | no | — | Number of pixels to extend to the bottom. Documented range: 0 or more. |
outpaint.left | integer | no | — | Number of pixels to extend to the left. Documented range: 0 or more. |
outpaint.right | integer | no | — | Number of pixels to extend to the right. Documented range: 0 or more. |
outpaint.blur | integer | no | — | Amount of blur to apply to the mask edge. Documented range: 0 to 32. |
lora | object[] | no | — | |
lora[].model | string | no | — | LoRA model identifier. |
lora[].weight | number | no | 1 | Strength of the LoRA influence. A value of 0 means no influence. Higher values increase the influence, and negative values can be used to steer away from the LoRA's style. Documented range: -4 to 4. |
hiresFix | string | no | — | Two-stage generation for improved resolution and detail. The model generates at a lower resolution first, then upscales and refines the result in a second pass. Can be enabled with true for default settings, or configured as an object for fine-grained control over the upscaling model, steps, and strength. When using the object form, the model parameter is required. Available upscaling models: | Model | Name | Upscale Factor | | --- | --- | --- | | serverless:504@1 | RealESRGAN_x4plus | 4x | | serverless:realesrgan@anime-6b | RealESRGAN_x4plus_anime_6B | 4x | | serverless:esrgan@animesharp | 4x-AnimeSharp | 4x | | serverless:esrgan@ultrasharp | 4x-UltraSharp | 4x | Simple (boolean): json "hiresFix": true Configured (object): json "hiresFix": { "model": "serverless:esrgan@ultrasharp", "steps": 15, "strength": 0.6 } |
trueCFGScale | number | no | — | True Classifier-Free Guidance scale. Higher values increase prompt adherence at the cost of quality. |
ultralytics | object | no | — | |
ultralytics.CFGScale | number | no | 8 | Face refinement guidance scale. Documented range: 0 to 50. |
ultralytics.confidence | number | no | 0.9 | Confidence threshold for detection. Documented range: 0 to 1. |
ultralytics.inpaintSize | integer | no | 1024 | Image size (in pixels) to use for each inpainting region. YOLO detects faces, crops the region, and scales it to this size before running diffusion. Set so most faces land in the 2–4× range of their original pixel size. Going beyond 8× may degrade identity resemblance. Documented range: 128 to 2,048. |
ultralytics.maskBlur | integer | no | 5 | Mask feathering amount. Higher values create softer transitions between the enhanced face region and surrounding areas. Documented range: 0 to 100. |
ultralytics.maskPadding | integer | no | 5 | Padding around detected face in pixels. Expands the refinement area to include surrounding context like hair and neck. Documented range: 0 to 20. |
ultralytics.negativePrompt | string | no | — | Negative prompt for detection. |
ultralytics.positivePrompt | string | no | — | Positive prompt for detection. |
ultralytics.steps | integer | no | 20 | Number of face refinement steps. Documented range: 1 to 100. |
ultralytics.strength | number | no | 0.3 | Refinement strength. Lower values preserve more of the original, higher values allow more aggressive reconstruction. Documented range: up to 1. |
outputType | string | no | "URL" | Image output type. One of "URL". |
outputFormat | string | no | "JPG" | Specifies the file format of the generated output. The available values depend on the task type and the specific model's capabilities. - `JPG`: Best for photorealistic images with smaller file sizes (no transparency). - `PNG`: Lossless compression, supports high quality and transparency (alpha channel). - `WEBP`: Modern format providing superior compression and transparency support. - `MP4`: Widely supported video container (H.264), recommended for general use. - `WEBM`: Optimized for web delivery. - `MOV`: QuickTime format, common in professional workflows (Apple ecosystem). - `GIF`: Animated image format (no audio), suitable for short loops or previews. - `MP3`: Compressed audio, smaller file size. - `WAV`: Uncompressed, high-quality audio. - `FLAC`: Lossless compression. - `OGG`: Open-source compressed audio format (Vorbis codec). - `SVG`: Scalable Vector Graphics. - `TIFF`: High-quality output supporting layers. - `GLB`: Binary glTF format for 3D models, including geometry, textures, and PBR materials. > [!NOTE] > **Transparency**: If you are using features like background removal or LayerDiffuse that require transparency, you must select a format that supports an alpha channel (e.g., `PNG`, `WEBP`, `TIFF`). `JPG` does not support transparency. One of "JPG", "PNG", "WEBP". |
outputQuality | integer | no | 95 | Compression quality of the output. Higher values preserve quality but increase file size. Documented range: 20 to 99. |
safety | object | no | — | |
safety.checkContent | boolean | no | — | Enable or disable content safety checking. Increases total generation time. Always on: a false is sent as true. |
advancedFeatures | object | no | — | |
advancedFeatures.watermark | object | no | — | |
advancedFeatures.watermark.text | string | no | — | Watermark text. Documented range: 2 to 32 characters. |
advancedFeatures.watermark.image | string | no | — | Watermark image (an http(s) URL; upload a local file first and send its read URL). A URL. |
advancedFeatures.watermark.displayPosition | string | no | — | Watermark position. One of "top-left", "top-center", "top-right", "center-left", "center-center", "center-right", "bottom-left", "bottom-center", "bottom-right", "tiled". |
advancedFeatures.watermark.opacity | number | no | — | Watermark opacity. Documented range: 0.1 to 1. |
advancedFeatures.watermark.fontColor | string | no | — | Text color in hex format. |
advancedFeatures.watermark.bgColor | string | no | — | Background color in hex format. |
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. |
#Rules
Across fields, as the model's documentation states them. Each is judged before anything is charged — warned with a Deprecation header until enforcement starts — and listed as JSON Schema under x-auray-rules in the openapi.json.
- Send
heightwheneverwidthis sent. Sendwidthwheneverheightis sent. - When
strengthis sent orinputs.maskImageis sent,inputs.seedImageis required. - Do not send
acceleratorOptions.cacheStartStepandacceleratorOptions.cacheStartStepPercentagetogether. Do not sendacceleratorOptions.cacheEndStepandacceleratorOptions.cacheEndStepPercentagetogether. Do not send a request whereacceleratorOptions.fbCacheis true andacceleratorOptions.teaCacheis true, or whereacceleratorOptions.fbCacheis true andacceleratorOptions.dbCacheis true, or whereacceleratorOptions.teaCacheis true andacceleratorOptions.dbCacheis true. - When
outpaintis sent: send at least one ofoutpaint.top,outpaint.bottom,outpaint.leftoroutpaint.right. loramust hold at least 1 item. In every item oflora:lora[].modelis required.- When
advancedFeatures.watermarkis sent: send exactly one ofadvancedFeatures.watermark.textoradvancedFeatures.watermark.image.
#Example
curl -X POST https://queue.auray.run/auray-serverless/bfl-flux-1-schnell \
-H "Authorization: Bearer $AURAY_API_KEY" \
-H "content-type: application/json" \
-d '{
"positivePrompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"width": 1536,
"height": 1024
}'import { createClient } from "@auray/client";
const auray = createClient(); // reads AURAY_API_KEY
const result = await auray.subscribe("auray-serverless/bfl-flux-1-schnell", {
input: {
"positivePrompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"width": 1536,
"height": 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-serverless/bfl-flux-1-schnell",
input={
"positivePrompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"width": 1536,
"height": 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-serverless/bfl-flux-1-schnell",
"input": {
"positivePrompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"width": 1536,
"height": 1024
}
}
}
}const res = await fetch("https://queue.auray.run/auray-serverless/bfl-flux-1-schnell", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AURAY_API_KEY}`,
"content-type": "application/json",
},
body: JSON.stringify({
"positivePrompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"width": 1536,
"height": 1024
}),
});
console.log(await res.json());import os, requests
r = requests.post(
"https://queue.auray.run/auray-serverless/bfl-flux-1-schnell",
headers={"Authorization": f"Bearer {os.environ['AURAY_API_KEY']}"},
json={
"positivePrompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"width": 1536,
"height": 1024
},
)
r.raise_for_status()
print(r.json())package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := []byte(`{
"positivePrompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"width": 1536,
"height": 1024
}`)
req, err := http.NewRequest("POST", "https://queue.auray.run/auray-serverless/bfl-flux-1-schnell", 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-serverless/bfl-flux-1-schnell");
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([
"positivePrompt" => "a brass orrery on a walnut desk, morning light from a window to the left",
"width" => 1536,
"height" => 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-serverless/bfl-flux-1-schnell")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV.fetch("AURAY_API_KEY")}"
req["Content-Type"] = "application/json"
req.body = {
"positivePrompt" => "a brass orrery on a walnut desk, morning light from a window to the left",
"width" => 1536,
"height" => 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 = """
{
"positivePrompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"width": 1536,
"height": 1024
}""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://queue.auray.run/auray-serverless/bfl-flux-1-schnell"))
.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-serverless/bfl-flux-1-schnell");
var body = """
{
"positivePrompt": "a brass orrery on a walnut desk, morning light from a window to the left",
"width": 1536,
"height": 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.