tokage/docs/quickstart
15 minutes

Quick Start

Install an SDK, grab an API key, and send your first token usage event. Every event is metered, cost-stamped, and available in the dashboard in real time.

1

Install the SDK

Choose your language:

Python

shell
pip install tokage

TypeScript / Node.js

shell
npm install @tokage/sdk
# or
yarn add @tokage/sdk
# or
pnpm add @tokage/sdk

Go

shell
go get github.com/tokage-io/tokage/sdks/go/tokage
2

Get your API key

API keys are managed from the dashboard. Keys start with tok_live_ for production.

Keep your API key secret. Never commit it to source control. Use environment variables: TOKAGE_API_KEY.

3

Send your first event

Replace tok_live_your_key_here with your API key. Cost is stamped server-side — never provide cost fields.

Python

python
from tokage import TokageClient, TokenUsageEvent

client = TokageClient(api_key="tok_live_your_key_here")

event_id = client.track(
    TokenUsageEvent(
        model_provider="anthropic",
        model_id="claude-sonnet-4-6",
        input_tokens=512,
        output_tokens=128,
        total_tokens=640,
        application_id="my-app",
        environment="production",
    )
)
print(f"Tracked: {event_id}")

TypeScript

typescript
import { TokageClient } from '@tokage/sdk';

const client = new TokageClient({ apiKey: 'tok_live_your_key_here' });

const eventId = await client.track({
  modelProvider: 'openai',
  modelId: 'gpt-4o',
  inputTokens: 1024,
  outputTokens: 256,
  totalTokens: 1280,
  applicationId: 'my-app',
  environment: 'production',
});

console.log('Tracked:', eventId);

Go

go
package main

import (
    "context"
    "fmt"
    "log"

    "github.com/tokage-io/tokage/sdks/go/tokage"
)

func main() {
    client := tokage.NewClient("tok_live_your_key_here")

    event := tokage.NewEvent("openai", "gpt-4o", 1024, 256).
        WithApplicationID("my-app").
        WithEnvironment("production")

    eventID, err := client.Track(context.Background(), event)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Tracked:", eventID)
}
4

See it in the dashboard

Events appear in the Overview dashboard within seconds. Costs are stamped server-side from the Price Registry — no configuration needed.

Open Overview