OpenAI SDK

Use the official OpenAI SDK with Pipevideo as a drop-in base URL replacement.

If you have existing code built on the OpenAI SDK, point it at Pipevideo to access video generation. Pipevideo supports both OpenAI API shapes:

OpenAI methodPipevideo endpointBest for
client.responses.createPOST /v1/responsesNew integrations (recommended)
client.chat.completions.createPOST /v1/chat/completionsExisting chat-completions clients
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.pipevideo.co/v1",
  apiKey: process.env.PIPEVIDEO_API_KEY,
  defaultHeaders: {
    "HTTP-Referer": "https://myapp.com",
    "X-Pipevideo-Title": "My Video App",
  },
});

const response = await client.responses.create({
  model: "moonshotai/kimi-k2.5",
  input: "Animated logo with pulsing circles",
  webhook_url: "https://example.com/webhooks/pipevideo",
});

console.log(response.id, response.status);

Poll for the result:

const result = await client.responses.retrieve(response.id);
console.log(result.output_video_url);

Chat Completions API

Use this if your integration already calls chat.completions.create:

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.pipevideo.co/v1",
  apiKey: process.env.PIPEVIDEO_API_KEY,
});

const completion = await client.chat.completions.create({
  model: "moonshotai/kimi-k2.5",
  messages: [
    { role: "user", content: "Animated logo with pulsing circles" },
  ],
  webhook_url: "https://example.com/webhooks/pipevideo",
});

console.log(completion.id, completion.status);

Poll for the result:

const result = await client.chat.completions.retrieve(completion.id);
console.log(result.choices[0]?.message.video_url?.url);

Python

Responses API:

from openai import OpenAI

client = OpenAI(
    base_url="https://api.pipevideo.co/v1",
    api_key="pv_your_api_key",
)

response = client.responses.create(
    model="moonshotai/kimi-k2.5",
    input="Animated logo with pulsing circles",
    extra_headers={
        "HTTP-Referer": "https://myapp.com",
        "X-Pipevideo-Title": "My Video App",
    },
)

print(response.id, response.status)

Chat Completions API:

completion = client.chat.completions.create(
    model="moonshotai/kimi-k2.5",
    messages=[
        {"role": "user", "content": "Animated logo with pulsing circles"},
    ],
)

print(completion.id, completion.status)

Differences from OpenAI

OpenAIPipevideo (Responses)Pipevideo (Chat Completions)
Text in output_textVideo URL in output_video_urlVideo URL in choices[0].message.video_url
Async — poll or pass webhook_urlAsync — poll or use webhooksAsync — poll or use webhooks
model is a chat modelmodel is an orchestration LLM idmodel is an orchestration LLM id
Per-token or per-request pricingToken-based orchestration billingToken-based orchestration billing

For the best experience with polling, waiting, and typed video responses, use the official TypeScript SDK (npm install pipevideo).

Verification

The API includes integration tests that run the official OpenAI SDK and Vercel AI SDK (@ai-sdk/openai + ai) against the real oRPC handler with a mocked backend:

cd apps/api && npm run test:integration