par Ideogram

Endpoint d'édition Ideogram 4.6 : une image_url, mask_url optionnel, jusqu'à trois références et edit_precision=high pour corriger un texte de 1K à 4K.

ideogram/4.6/edit
Ideogram 4.6 : générateur d’images IA en ligne
  • Jusqu’à 4K
  • Jusqu’à 3 images de référence
  • 7 formats d’image
  • Créer une image
  • Modifier une image

Appelez-le avec le nom de modèle ideogram/4.6/edit sur POST /jobs/createTask, à partir de 0,0096 $US.

Nom du modèleideogram/4.6/edit
Point de terminaisonPOST 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": "ideogram/4.6/edit",
  "input": {
    "prompt": "A ceramic teapot on a linen cloth, soft window light, muted palette",
    "edit_precision": "regular",
    "resolution": "1k",
    "quality": "medium",
    "image_url": "https://media.popnow.ai/influencer/examples/marco.webp"
  }
}'

# 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 est construit à partir du schéma ci-dessous : il passe la validation tel quel. Remplacez le prompt et les liens par les vôtres.

Prix

OptionUSD par image
quality very lowresolution 1K0,0096 $US
quality very lowresolution 2K0,0096 $US
quality lowresolution 1K0,036 $US
quality lowresolution 2K0,036 $US
quality lowresolution 4K0,072 $US
quality mediumresolution 1K0,072 $US
quality mediumresolution 2K0,072 $US
quality mediumresolution 4K0,24 $US
quality very lowresolution 4K0,24 $US
quality highresolution 1K0,264 $US
quality highresolution 2K0,264 $US
quality highresolution 4K0,72 $US

Facturation en USD · Toutes les options et leur prix : GET /models/ideogram/4.6/edit

Limites

Résolutions
1K · 2K · 4K
Formats d’image
1:1 · 4:3 · 3:4 · 3:2 · 2:3 · 16:9 · 9:16
Images de référence
3
Longueur du prompt (caractères)
10,000

Paramètres

Ces champs viennent du schéma avec lequel nous vérifions chaque requête. Les champs qui n’y figurent pas sont refusés.

  • image_urlstringObligatoire

    L’image de départ.

    Plage
    image/jpeg, image/png, image/webp, image/gif
  • promptstringObligatoire

    Décrivez ce que vous voulez créer.

    Plage
    Nombre de caractères: 1 – 10000
  • edit_precisionstringFacultatif

    high suit plus fidèlement vos demandes de retouche ; regular est la valeur par défaut.

    Par défaut
    "regular"
    Valeurs acceptées
    "regular""high"
  • aspect_ratiostringFacultatif

    La forme du cadre : large, carrée ou verticale.

    Valeurs acceptées
    "1:1""4:3""3:4""3:2""2:3""16:9""9:16"
  • resolutionstringFacultatifModifie le prix

    Choisissez une taille de sortie disponible.

    Par défaut
    "1k"
    Valeurs acceptées
    "1k""2k""4k"
  • qualitystringFacultatifModifie le prix

    Choisissez un réglage de qualité de ce modèle.

    Par défaut
    "medium"
    Valeurs acceptées
    "very_low""low""medium""high"
  • reference_image_urlsarray<string>Facultatif

    Des images des personnes, tenues ou lieux que le résultat doit conserver.

    Plage
    Nombre d’éléments: 0 – 3 · image/jpeg, image/png, image/webp, image/gif
  • mask_urlstringFacultatif

    Peignez la zone qui doit changer.

    Plage
    image/jpeg, image/png, image/webp, image/gif
Schéma JSON brut
{
  "additionalProperties": false,
  "properties": {
    "aspect_ratio": {
      "description": "Target width-to-height framing ratio for the output image.",
      "enum": [
        "1:1",
        "4:3",
        "3:4",
        "3:2",
        "2:3",
        "16:9",
        "9:16"
      ],
      "type": "string"
    },
    "edit_precision": {
      "default": "regular",
      "description": "Controls how closely edits preserve the source image geometry (regular or high).",
      "enum": [
        "regular",
        "high"
      ],
      "type": "string"
    },
    "image_url": {
      "contentMediaType": [
        "image/jpeg",
        "image/png",
        "image/webp",
        "image/gif"
      ],
      "description": "Primary source image URL to modify.",
      "format": "uri",
      "type": "string"
    },
    "mask_url": {
      "contentMediaType": [
        "image/jpeg",
        "image/png",
        "image/webp",
        "image/gif"
      ],
      "description": "Optional binary mask image URL restricting edits to the masked area.",
      "format": "uri",
      "type": "string"
    },
    "prompt": {
      "description": "Text instructions describing the image to generate or the edit to apply.",
      "maxLength": 10000,
      "minLength": 1,
      "type": "string"
    },
    "quality": {
      "default": "medium",
      "description": "Rendering quality tier controlling visual refinement and per-image rate.",
      "enum": [
        "very_low",
        "low",
        "medium",
        "high"
      ],
      "type": "string"
    },
    "reference_image_urls": {
      "description": "Optional visual reference image URLs guiding palette, subject, or layout.",
      "items": {
        "contentMediaType": [
          "image/jpeg",
          "image/png",
          "image/webp",
          "image/gif"
        ],
        "format": "uri",
        "type": "string"
      },
      "maxItems": 3,
      "type": "array"
    },
    "resolution": {
      "default": "1k",
      "description": "Output resolution tier controlling pixel dimensions and per-image billing.",
      "enum": [
        "1k",
        "2k",
        "4k"
      ],
      "type": "string"
    }
  },
  "required": [
    "prompt",
    "image_url"
  ],
  "type": "object"
}

Un vrai résultat de Ideogram 4.6

L’affiche de concert avec une nouvelle date et un tampon SOLD OUT
PromptKeep the whole poster design exactly as it is. Change only the date line to "Saturday 20 March 2027 · Second show added" in the same red typeface, and stamp the words "SOLD OUT" diagonally across the orange in red rubber-stamp ink.
La même requête via l’API
{
  "model": "ideogram/4.6/edit",
  "input": {
    "prompt": "Keep the whole poster design exactly as it is. Change only the date line to \"Saturday 20 March 2027 · Second show added\" in the same red typeface, and stamp the words \"SOLD OUT\" diagonally across the orange in red rubber-stamp ink.",
    "edit_precision": "high",
    "resolution": "2k",
    "quality": "medium",
    "image_url": "https://media.popnow.ai/influencer/examples/marco.webp",
    "aspect_ratio": "2:3"
  }
}

Ce résultat part d’un fichier envoyé : mettez votre propre lien à la place du lien d’exemple.

Réponses, suivi des tâches et callbacks

Tous les modèles fonctionnent de la même façon : créez une tâche, puis interrogez-la ou attendez le callback.

Connaître le prix d’abord

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": "ideogram/4.6/edit",
  "input": {
    "prompt": "A ceramic teapot on a linen cloth, soft window light, muted palette",
    "edit_precision": "regular",
    "resolution": "1k",
    "quality": "medium",
    "image_url": "https://media.popnow.ai/influencer/examples/marco.webp"
  }
}'

Avant l’exécution, envoyez le même corps de requête à POST /jobs/quote pour connaître les frais estimés et leur plafond en USD. Le devis ne lance aucune tâche et ne débite pas votre solde.

Acceptée

HTTP
HTTP/1.1 202 Accepted

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

HTTP 202 signifie que la tâche est acceptée : le plafond en USD reste réservé jusqu’au décompte final. À l’acceptation d’une tâche, le montant maximal du devis est réservé sur votre solde PopNow. À la fin, la facturation suit l’usage réel, sans dépasser ce montant, et le reste est libéré. En cas d’échec, le montant réservé est libéré.

Vérifier l’état

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

Interrogez le statut à quelques secondes d’intervalle en espaçant progressivement les appels. Arrêtez dès que state vaut succeeded, failed, canceled ou expired.

Tâche terminée

JSON
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_01k3m8x9q2z4v7n5p6r8s0t1w3",
    "model": "ideogram/4.6/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"
}

Téléchargez le fichier depuis url avant la date indiquée par expiresAt. Pour obtenir un nouveau lien, appelez POST /common/download-url.

Vérifier un 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
});

Si vous renseignez callBackUrl, nous vous envoyons la tâche une fois terminée. Vérifiez la signature à partir du corps brut de la requête webhook avant d’en traiter le contenu.

Envoyer un fichier 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.

Les liens https publics fonctionnent tels quels. Les fichiers locaux passent d’abord par upload-url et commit.