SDK
TypeScript SDK
Install and configure the Traceway TypeScript SDK.
The traceway npm package gives you two ways to send data to Traceway:
Tracewayclient — programmatic control over traces and spans. You decide when spans start and end.traceway/aisubpath — automatic instrumentation for the Vercel AI SDK via OpenTelemetry. No manual span management.
Install
npm install tracewayIf you're using the Vercel AI SDK integration, also install the OTel peer deps:
npm install traceway @opentelemetry/api @opentelemetry/sdk-trace-baseConfiguration
Both the client and the AI integration read from the same sources, in this order:
- Constructor options
- Environment variables
| Option | Env var | Default |
|---|---|---|
url | TRACEWAY_URL | http://localhost:3000 |
apiKey | TRACEWAY_API_KEY | none |
import { Traceway } from 'traceway';
// Explicit config
const tw = new Traceway({
url: 'https://api.traceway.ai',
apiKey: 'tw_sk_...',
});
// Or just set TRACEWAY_URL and TRACEWAY_API_KEY in your env
const tw2 = new Traceway();Package exports
The package has two entry points:
| Import path | What you get |
|---|---|
traceway | Traceway client class, all types |
traceway/ai | initTraceway(), TracewayExporter, mapper utilities |
// Main client
import { Traceway } from 'traceway';
// Vercel AI SDK integration
import { initTraceway } from 'traceway/ai';