Klaria

Quickstart

From zero to your first trace in about 5 minutes.

1. Get an API key

Create a free account, then go to Dashboard → API keys and create a project. Copy the key (shown once) into your environment:

# .env
KLARIA_API_KEY=kl_live_...

2. Install the SDK

npm install @klaria/sdk

3. Wrap your client

wrap()returns the same client you passed in. Calls go straight to the provider; capture happens off the request path with batched async flushes, so there's no added latency.

import Anthropic from '@anthropic-ai/sdk'
import { wrap } from '@klaria/sdk'

const claude = wrap(new Anthropic(), {
  apiKey: process.env.KLARIA_API_KEY,
})

const response = await claude.messages.create({
  model: 'claude-sonnet-4-6',
  max_tokens: 1024,
  messages: [{ role: 'user', content: 'Hello, Claude' }],
})

OpenAI clients work the same way — wrap(new OpenAI(), …) intercepts chat.completions.create.

4. Tag traces with metadata (optional)

Attach metadata to slice cost and quality by feature, endpoint, or customer:

const claude = wrap(new Anthropic(), {
  apiKey: process.env.KLARIA_API_KEY,
  metadata: { feature: 'support-bot', env: 'production' },
})

No SDK? Use the HTTP API

POST up to 100 traces per request to the ingestion endpoint. Returns 202 on success.

curl -X POST https://klaria.dev/api/v1/traces \
  -H "Authorization: Bearer $KLARIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[{
    "model": "claude-sonnet-4-6",
    "provider": "anthropic",
    "prompt": {"messages": [{"role": "user", "content": "Hello"}]},
    "completion": {"content": [{"type": "text", "text": "Hi!"}]},
    "input_tokens": 12,
    "output_tokens": 5,
    "latency_ms": 840,
    "status": "success",
    "metadata": {"feature": "support-bot"}
  }]'

Cost is computed server-side from token counts when total_cost_usd is omitted. Anthropic cache fields (anthropic_cache_creation_tokens, anthropic_cache_read_tokens) are first-class and feed the cache savings analytics.

5. Run your first eval

Once traces are flowing: Dashboard → Evals, write a rubric describing what a good response looks like, pick a judge model, and run it against your recent production traces. Failing traces link straight to the full request/response for debugging.

Stuck?

Email founder@klaria.dev— during early access you're talking directly to the founder, usually within hours.