PopNowAPI
Pegue sua chave de API

FLUX 3 Klein API

da Black Forest Labs

FLUX 3 Klein rápido: imagens e edições com várias referências em 1K ou 2K

black-forest-labs/flux-3-klein/edit
  • Até 2K
  • Até 10 imagens de referência
  • 16 proporções
  • Criar imagem
  • Editar imagem

Chame com o nome de modelo black-forest-labs/flux-3-klein/edit em POST /jobs/createTask, a partir de US$ 0,0192.

Nome do modeloblack-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"

O input é montado a partir do schema abaixo, então passa na validação como está. Troque o prompt e os links pelos seus.

Preço

OpçãoUSD por imagem
resolution 1KUS$ 0,0192
resolution 2KUS$ 0,0768

Cobrança em USD · Todas as opções e preços: GET /models/black-forest-labs/flux-3-klein/edit

Limites

Resoluções
1K · 2K
Proporções
auto · 1:1 · 16:9 · 9:16 · 4:3 · 3:4 +11
Imagens de referência
10
Tamanho do prompt (caracteres)
5,000
Maior upload
10 MB

Parâmetros

Estes campos vêm do mesmo schema que usamos para validar cada requisição. Campos que não estão na lista são rejeitados.

  • promptstringObrigatório

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

    Faixa
    1 – 5000 chars
  • image_urlsarray<string>ObrigatórioMuda o preço

    Fotos para editar ou combinar. Diga no prompt o que cada uma traz.

    Faixa
    1 – 10 items · image/jpeg, image/png, image/webp, image/gif · ≤ 10 MB
  • aspect_ratiostringOpcional

    O formato do quadro: horizontal, quadrado ou vertical.

    Padrão
    "auto"
    Valores aceitos
    "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"
  • resolutionstringOpcionalMuda o preço

    Tamanho de saída. Maior fica mais nítido e custa mais.

    Padrão
    "1k"
    Valores aceitos
    "1k""2k"
  • widthintegerOpcional

    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.

    Faixa
    256 – 1024
  • heightintegerOpcional

    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.

    Faixa
    256 – 1024
  • enable_prompt_expansionbooleanOpcional

    Deixa o modelo completar um prompt curto com detalhes.

    Padrão
    false
  • output_formatstringOpcional

    Tipo de arquivo do resultado.

    Padrão
    "jpeg"
    Valores aceitos
    "jpeg""png""webp"
  • seedintegerOpcional

    Repetir o mesmo número dá um resultado reproduzível.

    Faixa
    0 – 2147483647
JSON Schema bruto
{
  "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"
}

Respostas, consultas e callbacks

Todos os modelos funcionam do mesmo jeito: crie uma tarefa e depois consulte ou espere o callback.

Veja o preço antes

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"
  }
}'

Antes de executar, envie o mesmo corpo de requisição para POST /jobs/quote para ver o custo estimado e o máximo em USD. O orçamento não executa tarefas nem debita seu saldo.

Aceita

HTTP
HTTP/1.1 202 Accepted

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

HTTP 202 significa que a tarefa foi aceita: o máximo em USD fica reservado até o acerto final. Ao aceitar uma tarefa, reservamos o valor máximo do orçamento no seu saldo de API. Ao concluir, cobramos o uso real sem ultrapassar a reserva e liberamos o restante. Se a tarefa falhar, o valor reservado é liberado.

Consultar status

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

Consulte a cada poucos segundos, espaçando cada vez mais, e pare quando state for succeeded, failed, canceled ou expired.

Tarefa pronta

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"
}

Baixe pela url antes de expiresAt. Precisa de um link novo depois? Peça com POST /common/download-url.

Verificar um 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
});

Com callBackUrl definida, enviamos a tarefa pronta para você. Confira a assinatura no corpo bruto antes de confiar nela.

Enviar um arquivo local

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.

Links https públicos funcionam como estão. Arquivos locais passam antes por upload-url e commit.

Sobre o FLUX 3 Klein

FLUX 3 Klein rápido: imagens e edições com várias referências em 1K ou 2K.

Chame com o nome de modelo black-forest-labs/flux-3-klein/edit em POST /jobs/createTask, a partir de US$ 0,0192.

Parâmetros da requisição

ParâmetroObrigatórioDescrição
aspect_ratioNãoO formato do quadro: horizontal, quadrado ou vertical. 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 · Padrão: auto
enable_prompt_expansionNãoDeixa o modelo completar um prompt curto com detalhes. Padrão: false
heightNãoOutput 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_urlsSimFotos para editar ou combinar. Diga no prompt o que cada uma traz.
output_formatNãoTipo de arquivo do resultado. jpeg · png · webp · Padrão: jpeg
promptSimSay what to change and what must stay the same; name each source as <ref_image_1>, <ref_image_2>.
resolutionNãoTamanho de saída. Maior fica mais nítido e custa mais. 1k · 2k · Padrão: 1k
seedNãoRepetir o mesmo número dá um resultado reproduzível. ≥ 0 · ≤ 2147483647
widthNãoOutput 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

Preços

Os preços são em USD. A API usa um saldo separado em dólares americanos. Os créditos do site não podem ser usados na API nem convertidos em saldo de API, e o saldo de API não pode ser convertido em créditos do site. Ao aceitar uma tarefa, reservamos o valor máximo do orçamento no seu saldo de API. Ao concluir, cobramos o uso real sem ultrapassar a reserva e liberamos o restante. Se a tarefa falhar, o valor reservado é liberado.

OpçãoUSD por imagem
resolution 1KUS$ 0,0192
resolution 2KUS$ 0,0768

Antes de executar, envie o mesmo corpo de requisição para POST /jobs/quote para ver o custo estimado e o máximo em USD. O orçamento não executa tarefas nem debita seu saldo.

Início rápido da API

Chame a API do FLUX 3 Klein em três passos

  1. Crie uma chave de API. Entre na PopNow e crie uma chave no console da API. As chaves começam com sk-popnow-. As chamadas usam seu saldo separado em dólares americanos.
  2. Envie a requisição. Faça POST /jobs/createTask com model black-forest-labs/flux-3-klein/edit e um objeto input conforme a tabela de parâmetros. A resposta traz um ID de tarefa na hora.
  3. Pegue o resultado. Consulte GET /jobs/recordInfo com o ID da tarefa, ou passe uma callBackUrl e enviamos o resultado para ela. Baixe os links de saída quando a tarefa der certo.
# 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"

Troque o prompt e os links pelos seus. A aba API traz a referência da resposta, do polling e do callback.

Perguntas sobre a API do FLUX 3 Klein

Quanto custa a API do FLUX 3 Klein?

O FLUX 3 Klein custa a partir de US$ 0,0192 por imagem com Editar imagem, a tarefa mais barata. Preços por opção: 1K US$ 0,0192 por imagem, 2K US$ 0,0768 por imagem. A API usa um saldo separado em dólares americanos. Os créditos do site não podem ser usados na API nem convertidos em saldo de API, e o saldo de API não pode ser convertido em créditos do site. Ao aceitar uma tarefa, reservamos o valor máximo do orçamento no seu saldo de API. Ao concluir, cobramos o uso real sem ultrapassar a reserva e liberamos o restante. Se a tarefa falhar, o valor reservado é liberado.

Quais são os limites da API do FLUX 3 Klein · Editar imagem?

Resoluções: 1K · 2K; Proporções: auto · 1:1 · 16:9 · 9:16 · 4:3 · 3:4 +11; Imagens de referência: 10; Tamanho do prompt (caracteres): 5,000; Maior upload: 10 MB. Requisições fora desses limites são rejeitadas antes de qualquer cobrança.

Mais sobre o FLUX 3 Klein