SuperPenguin Docs
Getting Started

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.

pip install superpenguin

Or for TypeScript / Vercel AI SDK apps:

npm install @superpenguin/js

Keep 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.

Next steps

On this page