Quickstart
Install a SuperPenguin SDK, wrap a provider client, and attribute your first AI request.
Track AI costs by wrapping the provider client you already use. Calls go directly to the provider. The SDK only captures usage metadata.
Using OpenRouter and prefer no application instrumentation? Follow OpenRouter Broadcast instead. Choose either the SDK wrapper or Broadcast for the same traffic unless both share a generation ID.
pip install superpenguinOr for TypeScript / Vercel AI SDK apps:
npm install @superpenguin/jsKeep SP_API_KEY (and any provider keys) on the server. Do not ship them to browsers.
In the dashboard, open API Keys and create a key. It starts with sp_ / sp- and is shown once. See Create an API key.
import superpenguin as sp
from openai import OpenAI
sp.init(api_key="sp_...")
client = sp.wrap(OpenAI(), metadata={
"customer_id": "cust_acme_123",
"feature": "doc_summary",
"team": "product",
"environment": "production",
})
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
)TypeScript:
import OpenAI from "openai";
import { init, wrap } from "@superpenguin/js";
init({ apiKey: process.env.SP_API_KEY });
const openai = wrap(new OpenAI(), {
metadata: {
environment: "production",
feature: "support_agent",
},
});
await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello" }],
spMetadata: { customer_id: "cust_acme_123" },
});Open the SuperPenguin dashboard. You should see a request row with model, tokens or billing units, estimated cost, latency, and your metadata.