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 method | Pipevideo endpoint | Best for |
|---|---|---|
client.responses.create | POST /v1/responses | New integrations (recommended) |
client.chat.completions.create | POST /v1/chat/completions | Existing chat-completions clients |
Responses API (recommended)
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
| OpenAI | Pipevideo (Responses) | Pipevideo (Chat Completions) |
|---|---|---|
Text in output_text | Video URL in output_video_url | Video URL in choices[0].message.video_url |
Async — poll or pass webhook_url | Async — poll or use webhooks | Async — poll or use webhooks |
model is a chat model | model is an orchestration LLM id | model is an orchestration LLM id |
| Per-token or per-request pricing | Token-based orchestration billing | Token-based orchestration billing |
Recommended alternative
For the best experience with polling, waiting, and typed video responses, use the official TypeScript SDK (npm install pipevideo).
Related
- App attribution — optional headers for rankings
- Responses API — full HTTP reference
- Chat completions API — legacy-compatible HTTP reference
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