PopNowAPI
Prendi la chiave API

FLUX 3 Klein API

di Black Forest Labs

FLUX 3 Klein veloce: immagini e modifiche multi-riferimento in 1K o 2K

black-forest-labs/flux-3-klein/edit
  • Fino a 2K
  • Fino a 10 immagini di riferimento
  • 16 formati
  • Crea immagine
  • Modifica immagine

Lo chiami con il nome di modello black-forest-labs/flux-3-klein/edit su POST /jobs/createTask, da 0,0192 USD.

Nome del modelloblack-forest-labs/flux-3-klein/edit
EndpointPOST https://api.popnow.ai/api/v1/jobs/createTask
# 1. Create the task. Keep the Idempotency-Key if you retry after a network error.
export IDEMPOTENCY_KEY="$(uuidgen)"
curl -X POST https://api.popnow.ai/api/v1/jobs/createTask \
  -H "Authorization: Bearer $POPNOW_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -d '{
  "model": "black-forest-labs/flux-3-klein/edit",
  "input": {
    "prompt": "A ceramic teapot on a linen cloth, soft window light, muted palette",
    "image_urls": [
      "https://media.popnow.ai/influencer/examples/marco.webp"
    ],
    "aspect_ratio": "auto",
    "resolution": "1k",
    "output_format": "jpeg"
  }
}'

# 2. Copy data.taskId from the response, then poll until state is succeeded, failed, canceled or expired.
TASK_ID="TASK_ID_FROM_RESPONSE"
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
  -H "Authorization: Bearer $POPNOW_API_KEY"

L’input è costruito dallo schema qui sotto, quindi supera la verifica così com’è. Sostituisci prompt e link con i tuoi.

Prezzo

OpzioneUSD per immagine
resolution 1K0,0192 USD
resolution 2K0,0768 USD

Addebiti in USD · Tutte le opzioni e i prezzi: GET /models/black-forest-labs/flux-3-klein/edit

Limiti

Risoluzioni
1K · 2K
Proporzioni
auto · 1:1 · 16:9 · 9:16 · 4:3 · 3:4 +11
Immagini di riferimento
10
Lunghezza del prompt (caratteri)
5,000
Caricamento massimo
10 MB

Parametri

Questi campi vengono dallo stesso schema con cui verifichiamo ogni richiesta. I campi non elencati vengono rifiutati.

  • promptstringObbligatorio

    Say what to change and what must stay the same; name each source as <ref_image_1>, <ref_image_2>.

    Intervallo
    1 – 5000 chars
  • image_urlsarray<string>ObbligatorioCambia il prezzo

    Foto da modificare o combinare. Spiega nel prompt cosa aggiunge ciascuna.

    Intervallo
    1 – 10 items · image/jpeg, image/png, image/webp, image/gif · ≤ 10 MB
  • aspect_ratiostringFacoltativo

    La forma dell'inquadratura: larga, quadrata o verticale.

    Predefinito
    "auto"
    Valori ammessi
    "auto""1:1""16:9""9:16""4:3""3:4""3:2""2:3""4:5""5:4""21:9""9:21""2:1""1:2""3:1""1:3""custom"
  • resolutionstringFacoltativoCambia il prezzo

    Dimensione dell'output. Più grande è più nitido e costa di più.

    Predefinito
    "1k"
    Valori ammessi
    "1k""2k"
  • widthintegerFacoltativo

    Output width in pixels when aspect_ratio is custom, 256 to 1024 (1024 if left out); height works the same way. The price still follows resolution.

    Intervallo
    256 – 1024
  • heightintegerFacoltativo

    Output height in pixels when aspect_ratio is custom, 256 to 1024 (1024 if left out); width works the same way. The price still follows resolution.

    Intervallo
    256 – 1024
  • enable_prompt_expansionbooleanFacoltativo

    Lascia che il modello arricchisca un prompt breve.

    Predefinito
    false
  • output_formatstringFacoltativo

    Tipo di file del risultato.

    Predefinito
    "jpeg"
    Valori ammessi
    "jpeg""png""webp"
  • seedintegerFacoltativo

    Lo stesso numero dà un risultato ripetibile.

    Intervallo
    0 – 2147483647
JSON Schema grezzo
{
  "additionalProperties": false,
  "properties": {
    "aspect_ratio": {
      "default": "auto",
      "description": "Output aspect ratio; auto keeps the shape of the first source image, custom lets you set width and height.",
      "enum": [
        "auto",
        "1:1",
        "16:9",
        "9:16",
        "4:3",
        "3:4",
        "3:2",
        "2:3",
        "4:5",
        "5:4",
        "21:9",
        "9:21",
        "2:1",
        "1:2",
        "3:1",
        "1:3",
        "custom"
      ],
      "type": "string"
    },
    "enable_prompt_expansion": {
      "default": false,
      "description": "Rewrite the prompt into a fuller description before generating. Off by default, so the prompt is followed word for word.",
      "type": "boolean"
    },
    "height": {
      "description": "Output height in pixels when aspect_ratio is custom, 256 to 1024 (1024 if left out); width works the same way. The price still follows resolution.",
      "maximum": 1024,
      "minimum": 256,
      "type": "integer"
    },
    "image_urls": {
      "description": "One to ten source images, in the order your prompt refers to them. The second and third each raise the price a little; more do not.",
      "items": {
        "contentMediaType": [
          "image/jpeg",
          "image/png",
          "image/webp",
          "image/gif"
        ],
        "format": "uri",
        "minLength": 1,
        "type": "string"
      },
      "maxItems": 10,
      "minItems": 1,
      "type": "array"
    },
    "output_format": {
      "default": "jpeg",
      "description": "File format of the returned image.",
      "enum": [
        "jpeg",
        "png",
        "webp"
      ],
      "type": "string"
    },
    "prompt": {
      "description": "Say what to change and what must stay the same; name each source as <ref_image_1>, <ref_image_2>.",
      "maxLength": 5000,
      "minLength": 1,
      "type": "string"
    },
    "resolution": {
      "default": "1k",
      "description": "Output size tier: 1k is about one megapixel, 2k about four.",
      "enum": [
        "1k",
        "2k"
      ],
      "type": "string"
    },
    "seed": {
      "description": "Random seed for controlled comparisons.",
      "maximum": 2147483647,
      "minimum": 0,
      "type": "integer"
    },
    "width": {
      "description": "Output width in pixels when aspect_ratio is custom, 256 to 1024 (1024 if left out); height works the same way. The price still follows resolution.",
      "maximum": 1024,
      "minimum": 256,
      "type": "integer"
    }
  },
  "required": [
    "prompt",
    "image_urls"
  ],
  "type": "object"
}

Risposte, polling e callback

Tutti i modelli funzionano allo stesso modo: crei un task, poi lo interroghi o aspetti la callback.

Prima il prezzo

cURL
curl -X POST https://api.popnow.ai/api/v1/jobs/quote \
  -H "Authorization: Bearer $POPNOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "black-forest-labs/flux-3-klein/edit",
  "input": {
    "prompt": "A ceramic teapot on a linen cloth, soft window light, muted palette",
    "image_urls": [
      "https://media.popnow.ai/influencer/examples/marco.webp"
    ],
    "aspect_ratio": "auto",
    "resolution": "1k",
    "output_format": "jpeg"
  }
}'

Prima di eseguire, invia lo stesso corpo della richiesta a POST /jobs/quote per vedere il costo stimato e quello massimo in USD. Il preventivo non esegue alcuna richiesta né addebita il saldo.

Accettata

HTTP
HTTP/1.1 202 Accepted

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_01k3m8x9q2z4v7n5p6r8s0t1w3",
    "state": "queued"
  },
  "request_id": "req_example_create"
}

HTTP 202 indica che la richiesta è stata accettata: il massimo in USD resta riservato fino al conteggio finale. Quando una richiesta viene accettata, riserviamo l’importo massimo del preventivo sul tuo saldo API. Al termine addebitiamo l’uso effettivo, senza superare la riserva, e liberiamo il resto. Se la richiesta fallisce, l’importo riservato viene sbloccato.

Controlla lo stato

cURL
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
  -H "Authorization: Bearer $POPNOW_API_KEY"

Controlla ogni pochi secondi allungando via via l’intervallo e fermati quando state è succeeded, failed, canceled o expired.

Task completato

JSON
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_01k3m8x9q2z4v7n5p6r8s0t1w3",
    "model": "black-forest-labs/flux-3-klein/edit",
    "state": "succeeded",
    "output": {
      "assets": [
        {
          "url": "https://cdn.popnow.ai/tasks/task_01k3m8x9q2z4v7n5p6r8s0t1w3/output.png?signature=FROM_RESPONSE",
          "expiresAt": "2026-10-17T12:20:00Z",
          "mime": "image/png",
          "width": 1024,
          "height": 1024
        }
      ]
    },
    "settled": true
  },
  "request_id": "req_example_record"
}

Scarica dall’url prima di expiresAt. Ti serve un link nuovo più tardi? Chiedilo con POST /common/download-url.

Verifica una callback

Node.js
import { createHash, createHmac, timingSafeEqual } from "node:crypto";
import express from "express";

const app = express();
// express.raw keeps the exact bytes that were signed; express.json would not match.
app.post("/hooks/popnow", express.raw({ type: "application/json" }), (req, res) => {
  const timestamp = req.header("X-Webhook-Timestamp");
  const signature = req.header("X-Webhook-Signature") ?? "";
  const body = JSON.parse(req.body.toString("utf8"));
  const taskId = body.data?.taskId ?? body.task_id;
  const digest = createHash("sha256").update(req.body).digest("hex");
  const expected = createHmac("sha256", process.env.POPNOW_WEBHOOK_SECRET)
    .update(`${taskId}.${timestamp}.${digest}`)
    .digest("base64");
  const ok = expected.length === signature.length && timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
  // Check the signature first, then reject anything older than five minutes.
  if (!ok || Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return res.status(401).end();
  res.status(200).end(); // answer fast, then fetch the task and store its files
});

Con callBackUrl impostata ti inviamo il task completato. Verifica la firma sul corpo grezzo prima di fidarti.

Invia un file locale

cURL
curl -X POST https://api.popnow.ai/api/v1/common/upload-url \
  -H "Authorization: Bearer $POPNOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"contentType": "image/png", "bytes": 482113}'

# PUT the file bytes to data.uploadUrl with every header in data.headers, then commit it:
curl -X POST https://api.popnow.ai/api/v1/files/$FILE_ID/commit \
  -H "Authorization: Bearer $POPNOW_API_KEY"
# The commit returns a popnow://f/... reference. Put it in any image, video or
# audio field of the task input instead of a public https URL.

I link https pubblici funzionano così come sono. I file locali passano prima da upload-url e commit.

Informazioni su FLUX 3 Klein

FLUX 3 Klein veloce: immagini e modifiche multi-riferimento in 1K o 2K.

Lo chiami con il nome di modello black-forest-labs/flux-3-klein/edit su POST /jobs/createTask, da 0,0192 USD.

Parametri della richiesta

ParametroObbligatorioDescrizione
aspect_ratioNoLa forma dell'inquadratura: larga, quadrata o verticale. auto · 1:1 · 16:9 · 9:16 · 4:3 · 3:4 · 3:2 · 2:3 · 4:5 · 5:4 · 21:9 · 9:21 · 2:1 · 1:2 · 3:1 · 1:3 · custom · Predefinito: auto
enable_prompt_expansionNoLascia che il modello arricchisca un prompt breve. Predefinito: false
heightNoOutput height in pixels when aspect_ratio is custom, 256 to 1024 (1024 if left out); width works the same way. The price still follows resolution. ≥ 256 · ≤ 1024
image_urlsSìFoto da modificare o combinare. Spiega nel prompt cosa aggiunge ciascuna.
output_formatNoTipo di file del risultato. jpeg · png · webp · Predefinito: jpeg
promptSìSay what to change and what must stay the same; name each source as <ref_image_1>, <ref_image_2>.
resolutionNoDimensione dell'output. Più grande è più nitido e costa di più. 1k · 2k · Predefinito: 1k
seedNoLo stesso numero dà un risultato ripetibile. ≥ 0 · ≤ 2147483647
widthNoOutput width in pixels when aspect_ratio is custom, 256 to 1024 (1024 if left out); height works the same way. The price still follows resolution. ≥ 256 · ≤ 1024

Prezzi

I prezzi sono in USD. L’API usa un saldo separato in dollari statunitensi. I crediti del sito non si possono usare per l’API né convertire in saldo API; il saldo API non si può convertire in crediti del sito. Quando una richiesta viene accettata, riserviamo l’importo massimo del preventivo sul tuo saldo API. Al termine addebitiamo l’uso effettivo, senza superare la riserva, e liberiamo il resto. Se la richiesta fallisce, l’importo riservato viene sbloccato.

OpzioneUSD per immagine
resolution 1K0,0192 USD
resolution 2K0,0768 USD

Prima di eseguire, invia lo stesso corpo della richiesta a POST /jobs/quote per vedere il costo stimato e quello massimo in USD. Il preventivo non esegue alcuna richiesta né addebita il saldo.

Guida rapida all'API

Chiama l'API di FLUX 3 Klein in tre passaggi

  1. Crea una chiave API. Accedi a PopNow e crea una chiave nella console API. Le chiavi iniziano con sk-popnow-. Le chiamate usano il tuo saldo separato in dollari statunitensi.
  2. Invia la richiesta. Invia POST /jobs/createTask con model black-forest-labs/flux-3-klein/edit e un oggetto input secondo la tabella dei parametri. La risposta restituisce subito un ID attività.
  3. Recupera il risultato. Interroga GET /jobs/recordInfo con l'ID attività, oppure passa una callBackUrl e ti inviamo lì il risultato. Scarica i link di output quando l'attività riesce.
# 1. Create the task. Keep the Idempotency-Key if you retry after a network error.
export IDEMPOTENCY_KEY="$(uuidgen)"
curl -X POST https://api.popnow.ai/api/v1/jobs/createTask \
  -H "Authorization: Bearer $POPNOW_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -d '{
  "model": "black-forest-labs/flux-3-klein/edit",
  "input": {
    "prompt": "A ceramic teapot on a linen cloth, soft window light, muted palette",
    "image_urls": [
      "https://media.popnow.ai/influencer/examples/marco.webp"
    ],
    "aspect_ratio": "auto",
    "resolution": "1k",
    "output_format": "jpeg"
  }
}'

# 2. Copy data.taskId from the response, then poll until state is succeeded, failed, canceled or expired.
TASK_ID="TASK_ID_FROM_RESPONSE"
curl "https://api.popnow.ai/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
  -H "Authorization: Bearer $POPNOW_API_KEY"

Sostituisci il prompt e gli eventuali link con i tuoi. La scheda API contiene il riferimento per risposta, polling e callback.

Domande sull’API di FLUX 3 Klein

Quanto costa l’API di FLUX 3 Klein?

FLUX 3 Klein costa da 0,0192 USD per immagine con Modifica immagine, il suo task più economico. Prezzi per opzione: 1K 0,0192 USD per immagine, 2K 0,0768 USD per immagine. L’API usa un saldo separato in dollari statunitensi. I crediti del sito non si possono usare per l’API né convertire in saldo API; il saldo API non si può convertire in crediti del sito. Quando una richiesta viene accettata, riserviamo l’importo massimo del preventivo sul tuo saldo API. Al termine addebitiamo l’uso effettivo, senza superare la riserva, e liberiamo il resto. Se la richiesta fallisce, l’importo riservato viene sbloccato.

Quali sono i limiti dell’API di FLUX 3 Klein · Modifica immagine?

Risoluzioni: 1K · 2K; Proporzioni: auto · 1:1 · 16:9 · 9:16 · 4:3 · 3:4 +11; Immagini di riferimento: 10; Lunghezza del prompt (caratteri): 5,000; Caricamento massimo: 10 MB. Le richieste fuori da questi limiti vengono rifiutate prima di qualsiasi addebito.

Altro su FLUX 3 Klein