OtisDocs

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.

SDK Reference

Deeper details on each part of the SDK. Read these when you want to go beyond what the integration guide covers.

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, including the system prompt (turn it off with captureSystemPrompt: false)
  • Model ID and provider
  • Token usage (input, output, cache, reasoning), and the billed cost of calls made through OpenRouter
  • Tool calls with inputs and outputs
  • Decision model calls, counted in usage and cost and never as conversation turns
  • 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
  • The surface the user worked in, and the agent that handled the request
  • 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

On this page