Happy Pony API Get an API key →

Prompt enrichment

Pricing: Prompt enrichment

Every video prompt (text to video, image to video, reference to video) is rewritten on its way to the render queue, as on the website: a vision model looks at your images and video, keeps every fact, name, media label and quoted line, and expands the prompt into the production prose the model renders best from, with shots, framing, lighting, synchronized sound and the dialogue as a performance. Text to image prompts are rewritten too, always, by the Qwen-Image prompt rewriter (nothing turns it off). The other image jobs (image edit, multi-angle, face swap, human portrait) render the prompt as you send it.

Two kinds of prompt are passed through unchanged, because they are taken as written by a professional or a tool:

Nothing turns the rewrite off for a shorter prompt. The rewrite is dropped, and your prompt rendered as sent, only when it comes back empty or unchanged, 30 characters or shorter, or over the render model's length cap. To see what the rewrite makes of a prompt, enrich it first.

x-pipelet-force-enrichment

Send the header x-pipelet-force-enrichment: 1 on a video create request to have the prompt enriched whatever its length or structure:

curl -X POST https://api.happypony.io/api/v1/jobs/text-to-video \
  -H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
  -H "x-pipelet-force-enrichment: 1" \
  -d '{ "prompt": "…a 3200-character scene you still want expanded…" }'
Value Effect
1, true or any other value The prompt is always rewritten before rendering, long or structured prompts included.
0, false, no, off, or no header The default above: short prompts are rewritten, long or structured ones are rendered as sent.

Only the three video endpoints read the header, and a request with keyframes or <Picture N> labels in the prompt ignores it (those prompts follow the default rule above, so the labels survive). Text to image is always rewritten, and the other image endpoints and the video agent set their own value, so the header changes nothing there.

Enrich a prompt

POST /api/v1/jobs/enrich-prompt

The same rewrite a video job gets, on its own: send the prompt and the media the job would use, get the enriched prompt back. The call blocks, usually for a few seconds and rarely past a minute, and creates no job. Use it to see what a job would render from, to build your own prompt tooling, or to tell whether a prompt would be rewritten at all.

curl -X POST https://api.happypony.io/api/v1/jobs/enrich-prompt \
  -H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
  -d '{
    "type": "image-to-video",
    "prompt": "she looks up and laughs",
    "first_frame_url": "https://cdn.example.com/me.png",
    "duration": 10
  }'
{
  "type": "image-to-video",
  "original_prompt": "she looks up and laughs",
  "enriched_prompt": "Medium close-up of a woman in her late twenties at a sunlit café table, …",
  "enriched": true
}
Field Type Notes
type text-to-video | image-to-video | reference-to-video, required The job the prompt is for. It decides which media fields are accepted and the roles the rewrite gives them (frames to hit, references to draw from).
prompt string, required Up to 8000 characters. Written in any language; the rewrite keeps the prompt's language.
duration int 5–20 The clip length you will render, in seconds. Sets how much speech the rewrite allows. Default 5.
nsfw bool true for adult content, so the prompt goes to the model that accepts it. Default false.
first_frame_url, last_frame_url string image-to-video only. The same image inputs rules as the job.
reference_image_urls string[] ≤ 9 reference-to-video only.
reference_video_url string reference-to-video only.
reference_audio_urls string[] ≤ 3 reference-to-video only. Audio is not shown to the vision model, but telling it a voice exists changes how dialogue is written.

Unknown fields are a 400, and a media field on a type that does not take it (a frame on text-to-video, a reference on image-to-video) is one too. The media is downloaded and copied into your storage before the call, exactly as for a job, so a bad URL is a 400 invalid_media naming the field.

Field Type Description
original_prompt string Your prompt, trimmed.
enriched_prompt string The rewritten prompt, or original_prompt when nothing was changed.
enriched bool false when the original prompt came back.
reason string Only when enriched is false: unchanged (the model returned nothing new), too_short (the rewrite was 30 characters or shorter and was discarded) or over_length_cap (the rewrite would have exceeded the render model's prompt limit).

Errors use the usual shape. Besides invalid_request, invalid_media and unauthorized: 502 media_failed when the media could not be stored, 502 enrich_failed when the enrichment service failed for any reason other than being switched off (retry), 503 enrich_unavailable when enrichment is switched off.

The job's own rewrite runs on whatever you submit. A prompt returned here and submitted unchanged is rewritten again unless it is 3200 characters or longer or in the official structure (see Prompt enrichment), so use this endpoint to preview and to build prompts, not to pin the exact text a job renders from.

提示词增强

价格:提示词增强

每个视频提示词(文生视频、图生视频、参考生视频)在进入渲染队列前都会被改写,和网站上一样:一个视觉模型会查看你的图片和视频,保留所有事实、名称、媒体标签和引号中的台词,再把提示词扩写成模型最擅长渲染的制作文案——镜头、构图、光线、与动作同步的声音,以及作为表演的对白。文生图的提示词也一定会被改写,由 Qwen-Image 提示词改写器完成(无法关闭)。其他图片任务(图片编辑、多角度、换脸、虚拟人像)按你发送的提示词原样渲染。

以下两种提示词会原样通过,因为它们被视为由专业人员或工具写好的:

对更短的提示词,没有办法关闭改写。只有改写结果为空或与原文相同、不超过 30 个字符,或超出渲染模型的长度上限时,才会放弃改写、按原样渲染。想知道改写会把提示词变成什么样,请先增强提示词。

x-pipelet-force-enrichment

在视频创建请求上发送请求头 x-pipelet-force-enrichment: 1,无论提示词多长、是否已有结构,都会被增强:

curl -X POST https://api.happypony.io/api/v1/jobs/text-to-video \
  -H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
  -H "x-pipelet-force-enrichment: 1" \
  -d '{ "prompt": "…一段 3200 字以上、但你仍希望扩写的场景…" }'
取值 效果
1、true 或任何其他值 渲染前一定改写提示词,长提示词和结构化提示词也不例外。
0、false、no、off,或不发送 上面的默认行为:短提示词改写,长提示词或结构化提示词原样渲染。

只有三个视频接口读取这个请求头,而且带 keyframes 或提示词中含 <Picture N> 标签的请求会忽略它(这类提示词按上面的默认规则处理,标签因此得以保留)。文生图一定会改写,其他图片接口和 video agent 自行设定该值,所以请求头对它们没有影响。

增强提示词

POST /api/v1/jobs/enrich-prompt

视频任务所经历的同一次改写,单独提供:发送提示词和任务会用到的媒体,返回增强后的提示词。该调用是阻塞的,通常几秒钟,很少超过一分钟,不会创建任务。可用于查看任务实际会用什么文案渲染、搭建自己的提示词工具,或判断某个提示词是否会被改写。

curl -X POST https://api.happypony.io/api/v1/jobs/enrich-prompt \
  -H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
  -d '{
    "type": "image-to-video",
    "prompt": "她抬头笑了起来",
    "first_frame_url": "https://cdn.example.com/me.png",
    "duration": 10
  }'
{
  "type": "image-to-video",
  "original_prompt": "她抬头笑了起来",
  "enriched_prompt": "中近景,一位二十七八岁的女子坐在洒满阳光的咖啡馆桌前,……",
  "enriched": true
}
字段 类型 说明
type text-to-video | image-to-video | reference-to-video,必填 提示词对应的任务类型。它决定接受哪些媒体字段,以及改写时赋予它们的角色(要命中的帧、要取材的参考)。
prompt string,必填 最多 8000 个字符。任何语言均可;改写保持提示词原来的语言。
duration int 5–20 你将渲染的时长(秒)。决定改写允许多少台词。默认 5。
nsfw bool 成人内容设为 true,提示词会交给接受此类内容的模型。默认 false。
first_frame_url、last_frame_url string 仅 image-to-video。规则与任务的图片输入相同。
reference_image_urls string[] ≤ 9 仅 reference-to-video。
reference_video_url string 仅 reference-to-video。
reference_audio_urls string[] ≤ 3 仅 reference-to-video。音频不会交给视觉模型,但告知它存在人声会改变对白的写法。

未知字段返回 400;在不接受该媒体的类型上传媒体字段(在 text-to-video 上传帧、在 image-to-video 上传参考)同样返回 400。媒体会在调用前下载并复制到你的存储空间,与任务完全一致,因此无法使用的 URL 会返回 400 invalid_media 并指出字段名。

字段 类型 说明
original_prompt string 你的提示词(已去除首尾空白)。
enriched_prompt string 改写后的提示词;未改动时等于 original_prompt。
enriched bool 返回原提示词时为 false。
reason string 仅在 enriched 为 false 时返回:unchanged(模型没有返回新内容)、too_short(改写结果不超过 30 个字符,已丢弃)或 over_length_cap(改写结果会超出渲染模型的提示词上限)。

错误采用通用格式。除 invalid_request、invalid_media 和 unauthorized 外:媒体未能保存时返回 502 media_failed,增强服务因关闭以外的任何原因失败时返回 502 enrich_failed(请重试),增强功能关闭时返回 503 enrich_unavailable。

任务自身的改写会作用于你提交的任何提示词。从这个接口拿到并原样提交的提示词仍会被再次改写,除非它达到 3200 个字符或采用官方结构(见提示词增强)。因此这个接口用于预览和构建提示词,而不是锁定任务最终渲染所用的文本。