SuperPenguin Docs
SDKsTypeScript

OpenTelemetry

Submit existing OpenTelemetry spans to SuperPenguin for cost attribution.

If you already emit OpenTelemetry spans for LLM calls, submit them to SuperPenguin without wrapping a provider client.

import { submitSpan } from "@superpenguin/js";

await submitSpan(span, {
  metadata: {
    environment: "production",
    feature: "support_agent",
  },
});

Vercel AI SDK telemetry fields (functionId) and OpenTelemetry trace IDs are stored under custom_tags unless they map to a first-class attribution column.

Python correlation

Install the optional extra and keep an active OTel span around wrapped calls:

pip install "superpenguin[otel]"

When a span is active, the Python SDK stores trace_id, span_id, traceparent, and otel_scope under custom_tags. @sp.trace also stores superpenguin_trace_id for correlation.

Configuration reference (TypeScript)

init()

ParameterDefaultDescription
apiKeySP_API_KEYSuperPenguin key
baseUrlhttps://app.superpenguin.aiAPI endpoint
flushMode"immediate"Use "interval" for long-lived workers
batchSize50Max events per POST
flushIntervalMs5000Interval flush cadence
maxRetries2Transient failure retries
throwOnErrorfalsePropagate ingest errors
keepalivetruefetch keepalive for serverless

Call await flush() before shutting down interval-mode workers.