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()
| Parameter | Default | Description |
|---|---|---|
apiKey | SP_API_KEY | SuperPenguin key |
baseUrl | https://app.superpenguin.ai | API endpoint |
flushMode | "immediate" | Use "interval" for long-lived workers |
batchSize | 50 | Max events per POST |
flushIntervalMs | 5000 | Interval flush cadence |
maxRetries | 2 | Transient failure retries |
throwOnError | false | Propagate ingest errors |
keepalive | true | fetch keepalive for serverless |
Call await flush() before shutting down interval-mode workers.