Tīrtha is still being built, so some features and models may not work as expected yet. Billing always follows the prices shown. Something broken? Email [email protected].

Tīrtha

Models / Black Forest Labs

FLUX.1 schnell

by Black Forest Labs

Makes pictures from a written prompt.

Open weights · Apache-2.0Listed on Hugging Face Jul 31, 2024

FLUX.1 schnell turns a written prompt into a picture. It is made by Black Forest Labs. On Tīrtha it makes one image per call.

Text to image1024x1024One image per call
Takes on TīrthaText
Gives backImages
Sizes1024x1024
Images per call1
Get an API key
tirtha/flux-1-schnell

Add credits · Read the docs

Good at

  • Quick picturesThe maker says it makes good pictures in 1 to 4 steps.
  • Follows promptsThe maker reports prompt following close to closed models.
  • Open for businessApache-2.0, so personal, research and commercial use are all allowed.

Model card details

Made by
Black Forest Labs
Kind
Text to image
Licence
Apache-2.0
Listed on Hugging Face
Jul 31, 2024
Parameters
12 billion
Type
Rectified flow transformer
Steps
1 to 4
Read the full model card on Hugging Face →

What it makes

Made with FLUX.1 schnell. Real outputs, not edited, each with the exact prompt that made it (made at 1024x1024, saved as JPEG for the web).

A watercolour painting of hot air balloons over green hills at sunrise.
A watercolour painting of hot air balloons over green hills at sunrise.AI-generated
A glass terrarium on a sunlit windowsill holding a tiny mountain lake and pine forest, soft morning light, photorealistic.
A glass terrarium on a sunlit windowsill holding a tiny mountain lake and pine forest, soft morning light, photorealistic.AI-generated
A steaming bowl of noodle soup seen from above on a dark wooden table, warm light, food photography.
A steaming bowl of noodle soup seen from above on a dark wooden table, warm light, food photography.AI-generated
A koi pond seen from above with lily pads and falling cherry blossom petals, highly detailed.
A koi pond seen from above with lily pads and falling cherry blossom petals, highly detailed.AI-generated

Open weights, Apache-2.0 licence. Maker facts from Black Forest Labs's model card on Hugging Face (huggingface.co/black-forest-labs/FLUX.1-schnell). Limits are the ones Tīrtha enforces today.

Request and response

Fields you send

FieldRequiredValues
modelyestirtha/flux-1-schnell
promptyesText, 1 to 2,000 characters.
nnoImages to make. This model makes 1 per call, which is the default.
sizeno1024x1024. Default 1024x1024.
response_formatnob64_json only, which is the default.

Any other field is refused with unknown_parameter, so a typo never passes silently.

What comes back

HTTP/1.1 200 OK
Content-Type: application/json

{
  "created": 1762992000,
  "data": [
    {"b64_json": "<the image, base64>"}
  ],
  "model": "tirtha/flux-1-schnell",
  "usage": {
    "images": 1,
    "charged": "<US dollars, 6 decimals>",
    "estimated": false
  }
}

One data entry per image returned, each a base64 image. There is never a link to fetch. usage.images is what you are billed for.

If something goes wrong

Errors come back as JSON: {"error": {"code", "message", "type"}}. A call that fails is not charged.

HTTPCodeWhat it means
400invalid_promptThe prompt is empty or too long.
400invalid_nn is outside the range above.
400invalid_sizeThe size is not one this model makes.
400invalid_response_formatAnything other than b64_json.
400unknown_parameterA field the API does not take. Send only the fields above.
400invalid_requestThe body is not a JSON object.
400content_policyRefused by content policy. Nothing was charged.
400request_rejectedThe request was rejected. Nothing was charged.
402billing_requiredThis needs a prepaid credit account. Add credits in your dashboard first.
402insufficient_creditsNot enough prepaid credit for this request. The message says how much it may need.
404model_not_foundThe model id is wrong, or is not this kind of model.
404model_not_pricedThis model is not available yet.
429media_busyThis model is busy right now. Retry in a few seconds. Nothing was charged.
503billing_unavailableBilling is temporarily unavailable. Please retry.
503unavailableTemporarily unavailable. Nothing was charged.

What a job costs

100 pictures cost about -

Worked out from the live price above. You pay only for images returned.

How to use it

Pick it when you want good pictures from a prompt in a few seconds.

Model id tirtha/flux-1-schnell · POST https://api.tirtha.ai/v1/images/generations

Sizes1024x1024
Images per call1
Promptup to 2,000 characters
Comes back asbase64 in the JSON response
# 1. make the picture (on an error, its JSON body is printed: fix that before step 2) curl https://api.tirtha.ai/v1/images/generations \ -H "Authorization: Bearer $TIRTHA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "tirtha/flux-1-schnell", "prompt": "A red lighthouse on a rocky coast at sunrise, soft watercolour, wide shot", "n": 1, "size": "1024x1024"}' \ --fail-with-body -o image.json || cat image.json # 2. save it: decode the base64 and name the file by its first bytes python3 - <<'EOF' import base64, json d = base64.b64decode(json.load(open("image.json"))["data"][0]["b64_json"]) ext = "png" if d[:4] == b"\x89PNG" else "webp" if d[8:12] == b"WEBP" else "jpg" open("image-1." + ext, "wb").write(d) EOF
import base64, os, requests def ext(d): # the first bytes tell the file type return "png" if d[:4] == b"\x89PNG" else "webp" if d[8:12] == b"WEBP" else "jpg" r = requests.post("https://api.tirtha.ai/v1/images/generations", headers={"Authorization": "Bearer " + os.environ["TIRTHA_API_KEY"]}, json={"model": "tirtha/flux-1-schnell", "prompt": "A red lighthouse on a rocky coast at sunrise, soft watercolour, wide shot", "n": 1, "size": "1024x1024"}, # one image per call on this model timeout=120) if not r.ok: # the error body says what to fix; a failed call is not charged e = r.json()["error"] raise SystemExit(f'{e["code"]}: {e["message"]}') body = r.json() for i, img in enumerate(body["data"], 1): # one entry per image returned data = base64.b64decode(img["b64_json"]) with open(f"image-{i}.{ext(data)}", "wb") as f: f.write(data) print(body["usage"]) # images returned, what the call cost, estimated: false
// Node 18+. Keep TIRTHA_API_KEY on your server, never in a web page. import { writeFile } from "node:fs/promises"; const r = await fetch("https://api.tirtha.ai/v1/images/generations", { method: "POST", headers: { "Authorization": `Bearer ${process.env.TIRTHA_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ model: "tirtha/flux-1-schnell", prompt: "A red lighthouse on a rocky coast at sunrise, soft watercolour, wide shot", n: 1, size: "1024x1024" }), }); if (!r.ok) { const e = (await r.json()).error; throw new Error(e.code + ": " + e.message); } const body = await r.json(); for (const [i, img] of body.data.entries()) { // one entry per image returned const d = Buffer.from(img.b64_json, "base64"); const ext = d[0] === 0x89 ? "png" : d.toString("ascii", 8, 12) === "WEBP" ? "webp" : "jpg"; await writeFile(`image-${i + 1}.${ext}`, d); }