Otis SDK
TypeScript SDK for tracing AI applications, custom functions, and user events.
The Otis SDK (@runotis/sdk) traces AI operations, custom functions, and user events from your app. It works in Node.js, serverless runtimes, and the browser, with first-class Next.js support.
Instrument your products with AI
Otis provides several paths to integrating the SDK and instrumenting your apps using coding agents.
Framework integration guides
Start here to manually integrate the SDK. Each guide is self-contained — follow it end to end and your integration will be correct the first time.
Next.js on Vercel
App Router, streaming chat routes, server + browser.
Node.js server
Long-running servers (Express, Fastify, Hono, NestJS, Node adapters).
Serverless functions
AWS Lambda, Cloudflare Workers, Netlify, Firebase Functions.
Framework reference
Init patterns for Remix, SvelteKit, Nuxt, Astro, NestJS, and more.
OpenTelemetry
Integrate with an existing OpenTelemetry setup or OTLP pipeline.
SDK Reference
Deeper details on each part of the SDK. Read these when you want to go beyond what the integration guide covers.
Tracing
wrap(), traced(), span.log, supported AI frameworks.
Events and exceptions
Custom user-action events and application exception capture.
Identity
Users, groups, auth provider pass-through, session handling.
Feedback signals
Link user ratings and corrections to specific AI responses.
Browser & consent
Cookie identity, GDPR consent, CMP integrations.
Privacy
Client-side and server-side PII redaction, identifier hashing.
Customization
Configuration, beforeSend, debug logging, SDK exports.
What gets captured
Otis is privacy-first
By default, Otis redacts Personally Identifiable Information (PII), and user, session and other identifiers are pseudo-anonymized. Otis also makes it simple to follow consent processes for browser cookies to ensure GDPR compliance.
With otis.wrap(ai) around your AI framework:
- Prompts and responses (user-facing messages, not internal system prompts unless you enable it)
- Model ID and provider
- Token usage (input, output, cache)
- Tool calls with inputs and outputs
- Streaming metrics — time to first token, total duration, tokens per second
- Errors with stack traces
With context passed to wrap() or withContext():
- User, session, chat, and document IDs
- Group memberships (e.g. company, team)
- Custom metadata
With sendEvent(), identifyUser(), sendFeedbackSignal():
- Custom events (document exports, feature usage)
- User identity and persistent properties
- Feedback linked to specific AI responses