Happy Pony API Get an API key →

Multi-angle

Pricing: Multi-angle

One image in, new views of the same subject out: one image for every combination of the camera angles you pick. The same job as a generation on www.happypony.io/multi-angle.

POST https://api.happypony.io/api/v1/jobs/multi-angle
GET  https://api.happypony.io/api/v1/jobs/:requestId/status
GET  https://api.happypony.io/api/v1/jobs/:requestId
PUT  https://api.happypony.io/api/v1/jobs/:requestId/cancel

1) Create a request

POST https://api.happypony.io/api/v1/jobs/multi-angle with Content-Type: application/json.

Field Type Required Default Description
image_url string yes — The subject. See Image inputs.
azimuth string[] no front, right side, back, left side "front view", "front-right quarter view", "right side view", "back-right quarter view", "back view", "back-left quarter view", "left side view", "front-left quarter view".
elevation string[] no ["eye-level shot"] "low-angle shot", "eye-level shot", "elevated shot", "high-angle shot".
distance string[] no ["medium shot"] "close-up", "medium shot", "wide shot".

The job makes azimuth × elevation × distance images (the example: 3 × 2 × 1 = 6; the defaults: 4; everything: 96). Each list must be non-empty with no repeats: unlike the website, an empty list does not mean "all of them".

Request body:

{
  "image_url": "https://resource.pipelet.net/images/test/selfie3.png",
  "azimuth": ["front view", "front-right quarter view", "right side view"],
  "elevation": ["eye-level shot", "high-angle shot"],
  "distance": ["close-up"]
}
curl -X POST https://api.happypony.io/api/v1/jobs/multi-angle \
  -H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
  -d '{"image_url": "https://resource.pipelet.net/images/test/selfie3.png", "azimuth": ["front view", "front-right quarter view", "right side view"], "elevation": ["eye-level shot", "high-angle shot"], "distance": ["close-up"]}'

Response 202 (fields: Create response):

{
  "request_id": "48322",
  "type": "multi-angle",
  "status": "IN_QUEUE",
  "credits": 12,
  "status_url": "https://api.happypony.io/api/v1/jobs/48322/status",
  "response_url": "https://api.happypony.io/api/v1/jobs/48322",
  "cancel_url": "https://api.happypony.io/api/v1/jobs/48322/cancel"
}

2) Poll for status

Poll the status_url until status is COMPLETED, FAILED or CANCELLED (fields: Status response). A queued job can be cancelled with PUT on the cancel_url (Cancel a request).

curl https://api.happypony.io/api/v1/jobs/48322/status -H "Authorization: Bearer $HP_KEY"
{
  "request_id": "48322",
  "type": "multi-angle",
  "status": "IN_PROGRESS",
  "created_at": "2026-10-05T10:00:00.000Z",
  "completed_at": null,
  "credits": 12,
  "status_url": "…", "response_url": "…", "cancel_url": "…"
}

3) Fetch the result

When status is COMPLETED, fetch the response_url (common fields: Result response):

curl https://api.happypony.io/api/v1/jobs/48322 -H "Authorization: Bearer $HP_KEY"
{
  "request_id": "48322",
  "type": "multi-angle",
  "status": "COMPLETED",
  "created_at": "2026-10-05T10:00:00.000Z",
  "completed_at": "2026-10-05T10:01:40.000Z",
  "credits": 12,
  "images": [{ "url": "https://…signed…", "format": "png" }, { "url": "https://…signed…", "format": "png" }, "…"],
  "expires_in": 259200,
  "parameters": { "azimuth": ["front view", "front-right quarter view", "right side view"],
                  "elevation": ["eye-level shot", "high-angle shot"], "distance": ["close-up"] },
  "status_url": "…", "response_url": "…", "cancel_url": "…"
}
Field Type Description
images object[] One image per view.
parameters object azimuth, elevation, distance.

Full example

Create, poll until done, download:

curl (bash)

# Needs curl and jq. Usage: HP_KEY=hp_… ./angles.sh
JOB=$(curl -s -X POST https://api.happypony.io/api/v1/jobs/multi-angle \
  -H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
  -d '{"image_url": "https://resource.pipelet.net/images/test/selfie3.png",
       "azimuth": ["front view", "right side view", "back view", "left side view"],
       "elevation": ["eye-level shot"], "distance": ["medium shot"]}')
echo "$JOB" | jq .
STATUS_URL=$(echo "$JOB" | jq -r .status_url)
RESPONSE_URL=$(echo "$JOB" | jq -r .response_url)

while :; do
  STATUS=$(curl -s "$STATUS_URL" -H "Authorization: Bearer $HP_KEY" | jq -r .status)
  [ "$STATUS" = IN_QUEUE ] || [ "$STATUS" = IN_PROGRESS ] || break
  sleep 5
done
echo "$STATUS"
curl -s "$RESPONSE_URL" -H "Authorization: Bearer $HP_KEY" | jq -r '.images[] | "\(.format) \(.url)"' |
  while read -r FORMAT URL; do curl -s -o "view-$((++i)).$FORMAT" "$URL"; done

Python

# pip install requests   |   HP_KEY=hp_… python angles.py
import os, time, requests

BASE = "https://api.happypony.io/api/v1/jobs"
H = {"Authorization": f"Bearer {os.environ['HP_KEY']}"}

job = requests.post(f"{BASE}/multi-angle", headers=H, json={
    "image_url": "https://resource.pipelet.net/images/test/selfie3.png",
    "azimuth": ["front view", "front-right quarter view", "right side view"],
    "elevation": ["eye-level shot", "high-angle shot"],
    "distance": ["close-up"],
})  # 3 x 2 x 1 = 6 views
job.raise_for_status()
job = job.json()
print("job", job["request_id"], "costs", job["credits"], "credits")

while (s := requests.get(job["status_url"], headers=H).json())["status"] in ("IN_QUEUE", "IN_PROGRESS"):
    time.sleep(5)
result = requests.get(job["response_url"], headers=H).json()
if result["status"] != "COMPLETED":
    raise SystemExit(f"{result['status']}: {result.get('error', '')}")
for i, image in enumerate(result["images"]):
    with open(f"view-{job['request_id']}-{i}.{image['format']}", "wb") as f:
        f.write(requests.get(image["url"]).content)

多角度

价格:多角度

传入一张图片,输出同一主体的新视角:你所选相机角度的每一种组合各一张。与在 www.happypony.io/multi-angle 上生成的任务完全相同。

POST https://api.happypony.io/api/v1/jobs/multi-angle
GET  https://api.happypony.io/api/v1/jobs/:requestId/status
GET  https://api.happypony.io/api/v1/jobs/:requestId
PUT  https://api.happypony.io/api/v1/jobs/:requestId/cancel

1) 创建请求

POST https://api.happypony.io/api/v1/jobs/multi-angle,Content-Type: application/json。

字段 类型 必填 默认值 说明
image_url string 是 — 主体图片。见图片输入。
azimuth string[] 否 front, right side, back, left side "front view"、"front-right quarter view"、"right side view"、"back-right quarter view"、"back view"、"back-left quarter view"、"left side view"、"front-left quarter view"。
elevation string[] 否 ["eye-level shot"] "low-angle shot"、"eye-level shot"、"elevated shot"、"high-angle shot"。
distance string[] 否 ["medium shot"] "close-up"、"medium shot"、"wide shot"。

任务生成 azimuth × elevation × distance 张图片(示例为 3 × 2 × 1 = 6;默认 4 张;全选 96 张),与网站一样按张计价。每个列表都不能为空且不能重复:与网站不同,空列表不表示“全选”。

请求体:

{
  "image_url": "https://resource.pipelet.net/images/test/selfie3.png",
  "azimuth": ["front view", "front-right quarter view", "right side view"],
  "elevation": ["eye-level shot", "high-angle shot"],
  "distance": ["close-up"]
}
curl -X POST https://api.happypony.io/api/v1/jobs/multi-angle \
  -H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
  -d '{"image_url": "https://resource.pipelet.net/images/test/selfie3.png", "azimuth": ["front view", "front-right quarter view", "right side view"], "elevation": ["eye-level shot", "high-angle shot"], "distance": ["close-up"]}'

响应 202(字段见创建响应):

{
  "request_id": "48322",
  "type": "multi-angle",
  "status": "IN_QUEUE",
  "credits": 12,
  "status_url": "https://api.happypony.io/api/v1/jobs/48322/status",
  "response_url": "https://api.happypony.io/api/v1/jobs/48322",
  "cancel_url": "https://api.happypony.io/api/v1/jobs/48322/cancel"
}

2) 轮询状态

轮询 status_url,直到 status 变为 COMPLETED、FAILED 或 CANCELLED(字段见状态响应)。排队中的任务可以向 cancel_url 发送 PUT 取消(见取消请求)。

curl https://api.happypony.io/api/v1/jobs/48322/status -H "Authorization: Bearer $HP_KEY"
{
  "request_id": "48322",
  "type": "multi-angle",
  "status": "IN_PROGRESS",
  "created_at": "2026-10-05T10:00:00.000Z",
  "completed_at": null,
  "credits": 12,
  "status_url": "…", "response_url": "…", "cancel_url": "…"
}

3) 获取结果

status 为 COMPLETED 后,获取 response_url(通用字段见结果响应):

curl https://api.happypony.io/api/v1/jobs/48322 -H "Authorization: Bearer $HP_KEY"
{
  "request_id": "48322",
  "type": "multi-angle",
  "status": "COMPLETED",
  "created_at": "2026-10-05T10:00:00.000Z",
  "completed_at": "2026-10-05T10:01:40.000Z",
  "credits": 12,
  "images": [{ "url": "https://…signed…", "format": "png" }, { "url": "https://…signed…", "format": "png" }, "…"],
  "expires_in": 259200,
  "parameters": { "azimuth": ["front view", "front-right quarter view", "right side view"],
                  "elevation": ["eye-level shot", "high-angle shot"], "distance": ["close-up"] },
  "status_url": "…", "response_url": "…", "cancel_url": "…"
}
字段 类型 说明
images object[] 每个视角一张图片。
parameters object azimuth、elevation、distance。

完整示例

创建、轮询直到完成、下载:

curl (bash)

# Needs curl and jq. Usage: HP_KEY=hp_… ./angles.sh
JOB=$(curl -s -X POST https://api.happypony.io/api/v1/jobs/multi-angle \
  -H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
  -d '{"image_url": "https://resource.pipelet.net/images/test/selfie3.png",
       "azimuth": ["front view", "right side view", "back view", "left side view"],
       "elevation": ["eye-level shot"], "distance": ["medium shot"]}')
echo "$JOB" | jq .
STATUS_URL=$(echo "$JOB" | jq -r .status_url)
RESPONSE_URL=$(echo "$JOB" | jq -r .response_url)

while :; do
  STATUS=$(curl -s "$STATUS_URL" -H "Authorization: Bearer $HP_KEY" | jq -r .status)
  [ "$STATUS" = IN_QUEUE ] || [ "$STATUS" = IN_PROGRESS ] || break
  sleep 5
done
echo "$STATUS"
curl -s "$RESPONSE_URL" -H "Authorization: Bearer $HP_KEY" | jq -r '.images[] | "\(.format) \(.url)"' |
  while read -r FORMAT URL; do curl -s -o "view-$((++i)).$FORMAT" "$URL"; done

Python

# pip install requests   |   HP_KEY=hp_… python angles.py
import os, time, requests

BASE = "https://api.happypony.io/api/v1/jobs"
H = {"Authorization": f"Bearer {os.environ['HP_KEY']}"}

job = requests.post(f"{BASE}/multi-angle", headers=H, json={
    "image_url": "https://resource.pipelet.net/images/test/selfie3.png",
    "azimuth": ["front view", "front-right quarter view", "right side view"],
    "elevation": ["eye-level shot", "high-angle shot"],
    "distance": ["close-up"],
})  # 3 x 2 x 1 = 6 views
job.raise_for_status()
job = job.json()
print("job", job["request_id"], "costs", job["credits"], "credits")

while (s := requests.get(job["status_url"], headers=H).json())["status"] in ("IN_QUEUE", "IN_PROGRESS"):
    time.sleep(5)
result = requests.get(job["response_url"], headers=H).json()
if result["status"] != "COMPLETED":
    raise SystemExit(f"{result['status']}: {result.get('error', '')}")
for i, image in enumerate(result["images"]):
    with open(f"view-{job['request_id']}-{i}.{image['format']}", "wb") as f:
        f.write(requests.get(image["url"]).content)