From zero to first request in minutes.
One OpenAI-compatible API for every model, with typed SDKs, streaming, routing metadata and errors you can act on.
Three steps.
export API_KEY="pv-live-…"Install the SDK
Use the TypeScript or Python SDK, or skip this step and call the HTTP API directly.
npm install @pivotra/sdk# orpip install pivotraMake your first request
Use a specific model ID, or auto to let routing decide. The response tells you which model served it and what it cost.
1import Pivotra from "@pivotra/sdk";2 3const client = new Pivotra({ apiKey: process.env.API_KEY });4 5const response = await client.chat.completions.create({6 model: "auto",7 messages: [8 { role: "user", content: "Summarize this support ticket in one sentence." },9 ],10});11 12console.log(response.choices[0].message.content);13console.log(response.routing.model, response.usage.cost);1{2 "id": "req_8f2a91c04b7d",3 "object": "chat.completion",4 "model": "gpt-6-luna",5 "routing": {6 "strategy": "balanced",7 "model": "gpt-6-luna",8 "provider": "openai",9 "fallback_used": false,10 "decision_ms": 311 },12 "choices": [13 {14 "index": 0,15 "message": { "role": "assistant", "content": "Customer cannot reset their password after the latest update." },16 "finish_reason": "stop"17 }18 ],19 "usage": { "prompt_tokens": 182, "completion_tokens": 14, "total_tokens": 196, "cost": 0.0000357 }20}Typed clients, or plain HTTP.
Official clients for TypeScript and Python. Anything that speaks the OpenAI chat completions format works too.
Node 18+, Deno, Bun and edge runtimes. Full types for requests, responses and errors.
Sync and async clients, Python 3.9+, typed with Pydantic models.
OpenAI-compatible JSON over HTTPS. Works from any language.
Tokens as they’re generated.
1const stream = await client.chat.completions.create({2 model: "auto",3 stream: true,4 messages: [{ role: "user", content: "Write a haiku about latency." }],5});6 7for await (const chunk of stream) {8 process.stdout.write(chunk.choices[0]?.delta?.content ?? "");9}Errors you can act on.
1import Pivotra, { APIError, RateLimitError } from "@pivotra/sdk";2 3try {4 const res = await client.chat.completions.create({ model: "auto", messages });5} catch (err) {6 if (err instanceof RateLimitError) {7 // 429 — respect the Retry-After header8 await sleep(err.retryAfterMs);9 } else if (err instanceof APIError) {10 console.error(err.status, err.code, err.requestId);11 } else {12 throw err;13 }14}Integration guides.
Point an OpenAI-compatible client at the unified base URL.
Define a default policy, then override per request.
Render tokens as they arrive with server-sent events.
Typed errors, request IDs and Retry-After.
Scope, rotate and revoke keys without downtime.
Compare capabilities, context and price.