Get started in 5 minutes

ModelTrack is a reverse proxy that sits between your app and every LLM API. It tracks tokens, enforces budgets, routes to cheaper models, and caches responses — all in real-time, with zero code changes.

1

Start ModelTrack

Clone the repo and start all services with Docker Compose.

terminal
git clone https://github.com/ModelTrack/modeltrack.git
cd modeltrack
docker compose up

Once everything is running, you have three services:

  • Proxy at localhost:8080
  • Dashboard at localhost:5173
  • API at localhost:3001
2

Point your app at the proxy

The fastest way is auto-instrumentation — just import the SDK and all LLM calls are automatically routed through ModelTrack.

Python

app.py
import modeltrack  # Auto-patches Anthropic + OpenAI SDKs
import anthropic

client = anthropic.Anthropic()  # Already points to ModelTrack proxy
response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}]
)

Node.js / TypeScript

app.ts
import 'modeltrack'  // Auto-patches Anthropic + OpenAI SDKs
import Anthropic from '@anthropic-ai/sdk'

const client = new Anthropic()  // Already points to ModelTrack proxy
const response = await client.messages.create({
  model: 'claude-sonnet-4-6',
  max_tokens: 1024,
  messages: [{ role: 'user', content: 'Hello!' }]
})

Or, if you prefer not to use auto-instrumentation, manually set the base URL:

manual.py
# Python — manual base URL
client = anthropic.Anthropic(base_url="http://localhost:8080")

# OpenAI
client = openai.OpenAI(base_url="http://localhost:8080")
3

Add attribution headers (optional but recommended)

Attribution headers tell ModelTrack who is making each request. This enables per-team cost tracking, budget enforcement, and feature-level analytics.

headers.py
headers = {
    "X-ModelTrack-Team": "ml-research",
    "X-ModelTrack-App": "chatbot",
    "X-ModelTrack-Feature": "customer-support",
}

Or configure them globally with the SDK:

import modeltrack
modeltrack.configure(team="ml-research", app="chatbot", feature="customer-support")

Tip: All X-ModelTrack-* headers are optional. The proxy works without them — you just won't get team/feature-level attribution.

4

Open the dashboard

Go to localhost:5173 in your browser. You should see your first requests appearing within seconds.

The dashboard shows real-time cost tracking, token usage, model breakdowns, team attribution, and more — across 11 pages of analytics.

That's it! Your AI costs are now tracked.

Every LLM request now flows through ModelTrack. You get per-request cost tracking, token-level granularity, team attribution, and real-time dashboards — with zero changes to your application logic.

Next steps