← Back to articles Tutorial

Getting started with Tokoscope in 5 minutes

Emmanuel Ekunsumi · Jun 18, 2026 · 5 min read

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.

Prerequisites: An existing app using OpenAI, Anthropic, or Gemini. Node.js 18+ or Python 3.8+.

Step-by-step setup

1
Create your account

Go to app.tokoscope.com/signup and create a free account. You'll land on the dashboard.

2
Get your API key

Go to Settings → API Key. Copy your key — it starts with ts_live_.

3
Install the SDK

JavaScript

npm install tokoscope

Python

pip install tokoscope
4
Wrap your client

OpenAI (JavaScript)

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' }]
})

Anthropic (JavaScript)

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' }]
})

OpenAI (Python)

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'}]
)
5
Check your dashboard

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.

Optional: per-user tracking

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.

What happens automatically

Note: Tokoscope is designed to fail silently. If our servers are unreachable, your LLM calls continue working normally — no errors, no disruption.

Ready to start?

Create your free account and have Tokoscope running in under 5 minutes.

Get started free →