Happy Pony API Get an API key →

Happy Pony API

Two kinds of endpoints share one API key: the video agent (below) and single generations (text to image, text to video, image to video, reference to video, image edit, multi-angle, face swap, human portrait, voice design and character swap), which run one job with exactly the parameters you give. The same key also works with the OpenAI-compatible chat completions API for our hosted LLM. What everything costs is on the Pricing page.

Send reference material and instructions; the video agent decides everything (story, shots, prompt, canvas), renders, optionally reviews the result against your instructions and tries again, and hands back one or more videos. No questions are asked back and nothing needs confirming. With "job": "character_swap" the same agent instead swaps a person in your clip for a character from a picture, tuning the mask and the prompts itself and checking the result frame by frame against the source: see Character swap runs. With "job": "background_replace" it keeps the people and replaces everything around them: see Background replace runs.

Every call is authenticated with an API key. Create one at www.happypony.io → API Keys; the full key is shown once, so store it somewhere safe. Revoke a leaked key there and create a new one.

Authorization: Bearer hp_…

Session cookies are not accepted on these endpoints. Runs and jobs belong to the key's user: another user's id answers 404.

Base URL below: https://api.happypony.io.

Endpoint What it does
POST /api/v1/agent/runs/uploads Upload a local file; returns a URL to use in a run
POST /api/v1/agent/runs Start a video-agent run: a video, or a character swap
GET /api/v1/agent/runs/:id/status Poll for status
GET /api/v1/agent/runs/:id Get the result: videos, credits, parameters, log
PUT /api/v1/agent/runs/:id/cancel Cancel
POST /api/v1/jobs/text-to-image Generate an image from text
POST /api/v1/jobs/text-to-video Generate a video with sound from a prompt
POST /api/v1/jobs/image-to-video Animate a first / last frame, plus optional timed keyframes, into a video
POST /api/v1/jobs/reference-to-video A video of your reference people, products and voices in a new scene
POST /api/v1/jobs/image-edit Edit 1–3 images with an instruction
POST /api/v1/jobs/multi-angle New camera angles of one image
POST /api/v1/jobs/face-swap Put a reference face on a base image
POST /api/v1/jobs/human-portrait Portraits of a new person from attributes
POST /api/v1/jobs/voice-design Speech in a voice you describe
POST /api/v1/jobs/character-swap Swap a person in a clip for a character from a picture
POST /api/v1/jobs/background-replace Keep the people in a clip and replace everything around them
POST /api/v1/jobs/uploads Upload a local image, video or audio file for a job
GET /api/v1/jobs/:id/status Job status
GET /api/v1/jobs/:id Job result: image, video or audio URLs, parameters, credits
PUT /api/v1/jobs/:id/cancel Cancel a job
POST /v1/chat/completions Chat with the LLM (OpenAI-compatible, streaming, tools, images)
GET /v1/models List the LLM model
GET /api/v1/account/llm-usage Your LLM usage and cost
GET /api/v1/billing/records Every charge, filterable by your own userId, time, model and task
GET /api/v1/billing/users Charges added up per userId

Happy Pony API

同一个 API key 可调用两类接口:视频 agent(见下文)和单次生成,(文生图、文生视频、图生视频、参考生视频、图片编辑、多角度、换脸、虚拟人像、语音设计、角色替换和换背景),按你给定的参数精确执行一次任务。 同一个 key 还可以调用我们托管的 LLM:OpenAI 兼容的 chat completions 接口。各项费用见价格页面。

发送参考素材和指令,视频 agent 会自行决定一切(故事、分镜、提示词、画布),渲染视频,并可按你的指令审查结果、重新渲染,最后交付一个或多个视频。它不会向你反问,也无需任何确认。设置 "job": "character_swap" 时,同一个 agent 转而把视频中的人换成图片中的角色,自行调整遮罩和提示词,并逐帧对照原视频检查结果:见角色替换 run。

每次调用都需要 API key 鉴权。在 www.happypony.io → API Keys 创建;完整的 key 只显示一次,请妥善保存。key 泄露后请在同一页面吊销并重新创建。

Authorization: Bearer hp_…

这些接口不接受 session cookie。run 和任务(job)属于该 key 所属的用户:使用他人的 id 会返回 404。

下文的 Base URL 为 https://api.happypony.io。

接口 作用
POST /api/v1/agent/runs/uploads 上传本地文件;返回可在 run 中使用的 URL
POST /api/v1/agent/runs 发起 video-agent run:生成视频、角色替换或换背景
GET /api/v1/agent/runs/:id/status 轮询状态
GET /api/v1/agent/runs/:id 获取结果:视频、积分、参数、日志
PUT /api/v1/agent/runs/:id/cancel 取消
POST /api/v1/jobs/text-to-image 文生图
POST /api/v1/jobs/text-to-video 由提示词生成带声音的视频
POST /api/v1/jobs/image-to-video 由首帧 / 尾帧(可加定时关键帧)生成视频
POST /api/v1/jobs/reference-to-video 让参考里的人物、产品和声音出现在新场景中
POST /api/v1/jobs/image-edit 按指令编辑 1–3 张图片
POST /api/v1/jobs/multi-angle 生成同一图片的新相机角度
POST /api/v1/jobs/face-swap 把参考人脸换到底图上
POST /api/v1/jobs/human-portrait 按属性生成新人物的肖像
POST /api/v1/jobs/voice-design 用你描述的音色朗读文字
POST /api/v1/jobs/character-swap 把视频中的人换成图片中的角色
POST /api/v1/jobs/uploads 为任务上传本地图片、视频或音频
GET /api/v1/jobs/:id/status 任务状态
GET /api/v1/jobs/:id 任务结果:图片、视频或音频 URL、参数、积分
PUT /api/v1/jobs/:id/cancel 取消任务
POST /v1/chat/completions 与 LLM 对话(OpenAI 兼容:流式、工具调用、图片)
GET /v1/models 列出 LLM 模型
GET /api/v1/account/llm-usage 你的 LLM 用量与费用
GET /api/v1/billing/records 每一笔扣费,可按你自己的 userId、时间、模型和任务筛选
GET /api/v1/billing/users 按 userId 汇总的扣费