Documentation
Get started in minutes. Track your AI usage with just a few lines of code.
Supported: OpenAI, Anthropic|Coming soon: Gemini, Mistral, Groq, DeepSeek
Quick Start
1
Install the SDK
bash
npm install @with-orbit/sdk2
Initialize and wrap your client
javascript
import { Orbit } from '@with-orbit/sdk';
import OpenAI from 'openai';
const orbit = new Orbit({
apiKey: process.env.ORBIT_API_KEY,
});
// Wrap your OpenAI client
const openai = orbit.wrapOpenAI(new OpenAI());Get your API key from Settings in your dashboard.
3
Add feature tracking
javascript
// Track usage by feature
const chatClient = orbit.wrapOpenAI(new OpenAI(), {
feature: 'chat-assistant',
environment: 'production',
});
// Make API calls as normal
const response = await chatClient.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello!' }],
});What gets tracked
The SDK captures metadata about each AI request. Your prompts and responses are never sent to Orbit.
Feature name
Group requests by feature
Model
gpt-4o, claude-3, etc.
Tokens
Input and output counts
Latency
Request to response time
Cost
Estimated based on pricing
Status
Success or error
Environment Variables
bash
# Add to your .env file
ORBIT_API_KEY=orb_live_xxxxxxxxxxxx
OPENAI_API_KEY=sk-xxxxxxxxxxxxNote: Never commit API keys to version control.
SDK Features
Non-blocking
Analytics sent asynchronously
Lightweight
Minimal dependencies
Type-safe
Full TypeScript support
Secure
Your API keys never leave your app