PopNow API 文件

用你自己的程式碼生成圖片、影片和音訊

一把 API 金鑰、一套 REST 介面,模型和點數都與 popnow.ai 網站相同。送出一個任務,就能拿回生成的檔案。

三個步驟生成第一張圖

  1. 建立金鑰

    登入 popnow.ai,在 API 控制台建立金鑰。金鑰以 sk-popnow- 開頭,直接使用你帳戶裡現有的點數。

  2. 送出一個請求

    把下面這段貼到終端機執行。它請 Z-Image 生成一張圖,花費 2 點($0.02),最多等 60 秒直接取得結果。

    POST /api/v1/jobs/createTask?wait=60
    export POPNOW_API_KEY="sk-popnow-..."   # your key from the API console
    
    curl -X POST "https://api.popnow.ai/api/v1/jobs/createTask?wait=60" \
      -H "Authorization: Bearer $POPNOW_API_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: $(uuidgen)" \
      -d '{
      "model": "alibaba/z-image-turbo/text-to-image",
      "input": {
        "prompt": "A small red fox curled up in a teacup, soft morning light, studio photo"
      }
    }'
  3. 打開結果

    回應中的 output.assets[0].url 就是這張圖的簽名連結。影片這類較久的任務會先回傳 taskId,之後再用 recordInfo 查詢,或等 Webhook 通知。

    200 OK
    {
      "code": 200,
      "msg": "success",
      "data": {
        "taskId": "job_01JH8Z4Q5W2N7R3K9M6P1C0VXD",
        "model": "alibaba/z-image-turbo/text-to-image",
        "state": "succeeded",
        "output": {
          "assets": [
            {
              "url": "https://…signed-link…",
              "expiresAt": "2026-10-16T09:20:00Z",
              "mime": "image/png",
              "width": 1024,
              "height": 1024
            }
          ]
        },
        "credits": 2,
        "cost": "0.02",
        "settled": true
      },
      "request_id": "req_…"
    }

深入了解