This guide walks you through integrating Tokoscope into your existing LLM app. No infrastructure changes. No proxy servers. Just two lines of code and full token visibility.
Go to app.tokoscope.com/signup and create a free account. You'll land on the dashboard.
Go to Settings → API Key. Copy your key — it starts with ts_live_.
npm install tokoscope
pip install tokoscope
import OpenAI from 'openai'
import { wrap } from 'tokoscope'
const client = wrap(new OpenAI(), {
apiKey: 'ts_live_...'
})
// All your existing calls work unchanged
const response = await client.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello' }]
})
import Anthropic from '@anthropic-ai/sdk'
import { wrap } from 'tokoscope'
const client = wrap(new Anthropic(), {
apiKey: 'ts_live_...'
})
const response = await client.messages.create({
model: 'claude-sonnet-4-6',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello' }]
})
from openai import OpenAI
from tokoscope import wrap
client = wrap(OpenAI(), api_key='ts_live_...')
response = client.chat.completions.create(
model='gpt-4o',
messages=[{'role': 'user', 'content': 'Hello'}]
)
Make a few API calls, then go to app.tokoscope.com/dashboard. You should see token usage, cost, and waste scores appearing in real time.
If you want to track token usage per end user of your app, pass a userId:
// JavaScript
const client = wrap(new OpenAI(), {
apiKey: 'ts_live_...',
userId: currentUser.id
})
# Python
client = wrap(OpenAI(), api_key='ts_live_...', user_id=current_user.id)
Users will appear in the Users tab of your dashboard with individual token usage and waste scores.
Create your free account and have Tokoscope running in under 5 minutes.
Get started free →