Chat completions

Create and retrieve video generations via the OpenAI-compatible chat completions API.

Pipevideo supports the OpenAI Chat Completions API shape for video generation. Send messages with text, image, or video content parts; responses return video URLs in choices[0].message.video_url instead of text.

New integrations: Prefer the Responses API — it matches OpenAI's newer responses.create shape and includes output_video_url plus typed output items. Chat completions remain fully supported for existing OpenAI SDK integrations that use chat.completions.create.

Create generation

POST /v1/chat/completions

Authentication: API key required

Request body

ParameterTypeRequiredDescription
modelstringYesOrchestration LLM id (e.g. moonshotai/kimi-k2.5). Not an engine slug.
messagesarrayYesOpenAI-style chat messages with text, image, or video content parts.
enginestringNohyperframes, lottie, or auto. Default: hyperframes.
expand_promptbooleanNoImprove the prompt with the engine's prompting guide first.
widthnumberNoCanvas width in pixels. Default 1080.
heightnumberNoCanvas height in pixels. Default 1920.
aspectRatiostringNoAspect ratio hint (e.g. 16:9).
providerobjectNoProvider routing. See Provider routing.
webhook_urlstringNoHTTPS URL to receive lifecycle webhooks for this generation. Must be publicly reachable (localhost and private IPs are rejected).

Example

curl -X POST https://api.pipevideo.co/v1/chat/completions \
  -H "Authorization: Bearer pv_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "moonshotai/kimi-k2.5",
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "A cat walking on a beach at sunset" }
        ]
      }
    ],
    "webhook_url": "https://example.com/webhooks/pipevideo",
    "provider": { "order": ["framerate"] }
  }'

For multimodal prompts, use OpenAI-style content part types (text, image_url, video_url). See Multimodal inputs.

Create response

{
  "id": "gen_abc123xyz",
  "object": "chat.completion",
  "status": "pending",
  "model": "moonshotai/kimi-k2.5",
  "engine": "hyperframes",
  "provider": "framerate",
  "created": 1709827200,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": null,
        "video_url": null
      },
      "finish_reason": null
    }
  ],
  "usage": null
}

Get generation

GET /v1/chat/completions/{id}

Authentication: API key required

Retrieve the current status and result of a generation. Poll until status is completed, failed, or cancelled.

Response fields

FieldTypeDescription
idstringGeneration ID
objectstringAlways chat.completion
statusstringpending, processing, completed, failed, or cancelled
modelstringOrchestration model id
enginestringRendering engine (e.g. hyperframes)
providerstring | nullVideo orchestration provider slug
choicesarrayVideo URL in choices[0].message.video_url when completed
usageobject | nullToken usage and cost_usd when available
latency_msnumber | nullEnd-to-end latency when completed
errorobject | null{ message, type } when failed or cancelled
creatednumberUnix timestamp (seconds)
completed_atnumber | nullCompletion timestamp (milliseconds)
artifact_urlobject | nullNative engine artifact URL (e.g. Lottie JSON) when produced
artifact_typestring | nullMedia type of artifact_url

Completed response example

{
  "id": "gen_abc123xyz",
  "object": "chat.completion",
  "status": "completed",
  "model": "moonshotai/kimi-k2.5",
  "engine": "hyperframes",
  "provider": "framerate",
  "created": 1709827200,
  "completed_at": 1709827260000,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": null,
        "video_url": {
          "url": "https://storage.example.com/videos/abc123.mp4",
          "expires_at": 1709913660
        }
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 1200,
    "completion_tokens": 3400,
    "total_tokens": 4600,
    "cost_usd": 0.12
  },
  "latency_ms": 58000
}

Cancel generation

DELETE /v1/chat/completions/{id}

Authentication: API key required

Cancel an in-flight generation. Returns { "id": "...", "cancelled": true }.

Status transitions

pending → processing → completed
                   → failed
                   → cancelled

Transitions are one-way. Poll every 2–5 seconds, or pass webhook_url on create to receive webhook events instead.

Responses API equivalent

Chat completionsResponses API
messagesinput (+ optional instructions)
choices[0].message.video_urloutput_video_url and output items
status: "pending"status: "queued"
status: "processing"status: "in_progress"
aspectRatioaspect_ratio
Content parts: text, image_url, video_urlContent parts: input_text, input_image, input_video

Both APIs create the same underlying generation — use whichever shape fits your client.