Flux Kontext
Image model, from $0.031 per image.
Image
flux1-kontextUse with POST /v1/jobs, POST /v1/images/generations.
Price
| Settings | Price |
|---|---|
| pro, text to image | $0.031 per image |
| max, text to image | $0.063 per image |
Input fields
| Field | Type or options | Default |
|---|---|---|
prompt | string | |
model | flux-kontext-pro flux-kontext-max | "flux-kontext-pro" |
enable_translation | boolean | |
upload_cn | boolean | |
input_image | string | |
aspect_ratio | 21:9 16:9 4:3 1:1 3:4 9:16 | "1:1" |
output_format | jpeg png | "jpeg" |
prompt_upsampling | boolean | false |
safety_tolerance | 0 1 2 3 4 5 6 | 2 |
watermark | string |
Files are public https links. Safety filters are always on.
Example
curl https://pinerouter.ai/v1/jobs \
-H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
-d '{"model":"flux1-kontext","input":{"model":"flux-kontext-pro","aspect_ratio":"1:1","output_format":"jpeg","prompt_upsampling":false,"safety_tolerance":2,"prompt":"Describe what you want"}}'Then poll GET /v1/jobs/<id> until data.status is succeeded (links in data.outputs), or pass webhook_url to be called when it finishes; see Jobs.
import time, requests
BASE, H = "https://pinerouter.ai", {"Authorization": "Bearer YOUR_API_KEY"}
job = requests.post(f"{BASE}/v1/jobs", headers=H, json={"model":"flux1-kontext","input":{"model":"flux-kontext-pro","aspect_ratio":"1:1","output_format":"jpeg","prompt_upsampling":False,"safety_tolerance":2,"prompt":"Describe what you want"}}).json()["data"]
while job["status"] not in ("succeeded", "failed"):
time.sleep(5)
job = requests.get(f"{BASE}/v1/jobs/{job['id']}", headers=H).json()["data"]
print(job["outputs"] or job.get("error"))