Pruna AI

popnow/pruna-ai/p-h3-image-lora/editで最大3つのMiniMax H3 LoRAと整数seedを使い最大9枚の参照画像をスタイル編集。

pruna-ai/p-h3-image-lora/edit
P-H3-Image LoRA のAI画像生成をオンラインで
  • 最大4K
  • 参照画像は最大9枚
  • 15種類のアスペクト比
  • 自分のLoRAを読み込める
  • 画像を作成
  • 画像を編集

POST /jobs/createTask でモデル名に pruna-ai/p-h3-image-lora/edit を指定すれば呼び出せます。$0.054から。

モデル名pruna-ai/p-h3-image-lora/edit
エンドポイントPOST 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": "pruna-ai/p-h3-image-lora/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"
    ],
    "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"

input は下のスキーマに従って作成しており、そのまま検証を通過します。プロンプトとリンクを使用したい内容に置き換えてください。

料金

オプションUSD /枚
resolution 1K$0.048
resolution 1.5K$0.066
resolution 2K$0.084
resolution 3K$0.156
resolution 4K$0.228

米ドル建ての料金 · すべてのオプションと料金:GET /models/pruna-ai/p-h3-image-lora/edit

制限

解像度
1K · 1.5K · 2K · 3K · 4K
アスペクト比
1:1 · 16:9 · 9:16 · 4:3 · 3:4 · 3:2 +9
参照画像
9
プロンプトの長さ(文字)
5,000
アップロードの上限
10 MB

パラメーター

リクエストの検証に使うスキーマと同じフィールドを掲載しています。ここにないフィールドは受け付けません。

  • promptstring必須

    つくりたいものを説明してください。

    範囲
    文字数: 1 – 5000
  • image_urlsarray<string>必須料金が変わります

    編集・合成する写真。それぞれの役割をプロンプトに書きます。

    範囲
    項目数: 1 – 9 · image/jpeg, image/png, image/webp, image/gif · ≤ 10 MB
  • aspect_ratiostring任意

    画面の形:横長、正方形、縦長。

    指定できる値
    "1:1""16:9""9:16""4:3""3:4""3:2""2:3""21:9""9:21""2:1""1:2""3:1""1:3""5:4""4:5"
  • resolutionstring任意料金が変わります

    利用できる出力サイズを選びます。

    デフォルト
    "1k"
    指定できる値
    "1k""1.5k""2k""3k""4k"
  • lorasarray<object>任意

    モデルに対応する LoRA の重みを加え、画風やキャラクターを指定します。

    デフォルト
    []
    範囲
    項目数: 0 – 3
    内部のフィールド
    • loras[].pathstring必須

      LoRA の重みファイルを直接ダウンロードできる URL です。

      範囲
      文字数: ≥ 1 · application/octet-stream
    • loras[].scalenumber必須

      この LoRA を結果にどの程度反映するかを調整します。

      デフォルト
      1
      範囲
      0 – 4
  • output_formatstring任意

    結果のファイル形式。

    デフォルト
    "jpeg"
    指定できる値
    "jpeg""png""webp"
  • seedinteger任意

    同じ seed と設定で、比較条件をそろえられます。

    範囲
    0 – 2147483647
JSON スキーマ(原文)
{
  "additionalProperties": false,
  "properties": {
    "aspect_ratio": {
      "description": "Output aspect ratio. Leave it unset to follow the first image.",
      "enum": [
        "1:1",
        "16:9",
        "9:16",
        "4:3",
        "3:4",
        "3:2",
        "2:3",
        "21:9",
        "9:21",
        "2:1",
        "1:2",
        "3:1",
        "1:3",
        "5:4",
        "4:5"
      ],
      "type": "string"
    },
    "image_urls": {
      "description": "One to nine images. The first is edited; the rest are references. Each one after the first raises the quote.",
      "items": {
        "contentMediaType": [
          "image/jpeg",
          "image/png",
          "image/webp",
          "image/gif"
        ],
        "format": "uri",
        "minLength": 1,
        "type": "string"
      },
      "maxItems": 9,
      "minItems": 1,
      "type": "array"
    },
    "loras": {
      "default": [],
      "description": "Up to three LoRA files trained for MiniMax H3, each with its own strength. Use a direct file link.",
      "items": {
        "additionalProperties": false,
        "properties": {
          "path": {
            "contentMediaType": [
              "application/octet-stream"
            ],
            "description": "Direct URL of a LoRA weights file.",
            "format": "uri",
            "minLength": 1,
            "type": "string"
          },
          "scale": {
            "default": 1,
            "description": "Weight strength from zero to four.",
            "maximum": 4,
            "minimum": 0,
            "type": "number"
          }
        },
        "required": [
          "path",
          "scale"
        ],
        "type": "object"
      },
      "maxItems": 3,
      "type": "array"
    },
    "output_format": {
      "default": "jpeg",
      "description": "Container of the returned image.",
      "enum": [
        "jpeg",
        "png",
        "webp"
      ],
      "type": "string"
    },
    "prompt": {
      "description": "Say what to change. Refer to the images as <Picture 1>, <Picture 2> and so on; Picture 1 is the one being edited. Put a LoRA's trigger word first.",
      "maxLength": 5000,
      "minLength": 1,
      "type": "string"
    },
    "resolution": {
      "default": "1k",
      "description": "Output size tier: 1k is about 1 megapixel, 1.5k about 2.4, 2k about 4, 3k about 9.4, 4k about 16.8.",
      "enum": [
        "1k",
        "1.5k",
        "2k",
        "3k",
        "4k"
      ],
      "type": "string"
    },
    "seed": {
      "description": "Random seed for controlled comparisons.",
      "maximum": 2147483647,
      "minimum": 0,
      "type": "integer"
    }
  },
  "required": [
    "prompt",
    "image_urls"
  ],
  "type": "object"
}

P-H3-Image LoRAで作った実例

コペンハーゲンの街角に立つ女性のアニメ絵を人物リアリズムLoRAで実写写真に変換
プロンプトr34l1sm, turn the anime drawing in <Picture 1> into a real photograph of a woman with a black bob in a white t-shirt and light blue jeans standing on the same cobbled Copenhagen street with pastel houses, natural skin texture, soft overcast daylight.
同じ内容の API リクエスト
{
  "model": "pruna-ai/p-h3-image-lora/edit",
  "input": {
    "prompt": "r34l1sm, turn the anime drawing in <Picture 1> into a real photograph of a woman with a black bob in a white t-shirt and light blue jeans standing on the same cobbled Copenhagen street with pastel houses, natural skin texture, soft overcast daylight.",
    "image_urls": [
      "https://media.popnow.ai/influencer/examples/marco.webp"
    ],
    "resolution": "1k",
    "output_format": "jpeg",
    "seed": 4
  }
}

この作例はアップロードしたファイルから作っています。例のリンクを自分のファイルのリンクに替えてください。

レスポンス、ポーリング、コールバック

どのモデルも使い方は同じです。タスクを作成し、ポーリングするかコールバックを待ちます。

先に見積もる

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": "pruna-ai/p-h3-image-lora/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"
    ],
    "resolution": "1k",
    "output_format": "jpeg"
  }
}'

実行前に同じリクエスト本文を POST /jobs/quote に送ると、想定料金と上限額を米ドルで確認できます。見積もりではタスクの実行も課金も行いません。

受付済み

HTTP
HTTP/1.1 202 Accepted

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

HTTP 202 は受理済みを意味し、米ドルの上限額を精算まで確保します。 タスクの受理時に、見積もりの上限額を PopNow 残高から確保します。完了後は実際の使用量で精算し、確保額を超える請求はせず、差額を解放します。タスクが失敗した場合は確保額を解放します。

状態の確認

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

間隔を少しずつ空けながら数秒ごとに確認し、state が succeeded、failed、canceled、expired のいずれかになったら止めます。

完了したタスク

JSON
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_01k3m8x9q2z4v7n5p6r8s0t1w3",
    "model": "pruna-ai/p-h3-image-lora/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"
}

expiresAt までに url からダウンロードしてください。あとで新しいリンクが必要なら POST /common/download-url を使います。

コールバックを検証する

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

callBackUrl を指定すると、完了したタスクをお送りします。受信内容を処理する前に、未加工のリクエスト本文を使って署名を検証してください。

ローカルファイルを送る

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.

公開 https リンクはそのまま使えます。ローカルファイルは先に upload-url と commit を通します。