Complete documentation for the OwlMetric AI Cost Tracking & Analytics Platform.
This documentation is organized into the following sections:
OwlMetric offers two main integration approaches:
| Provider | Models | Proxy Support | SDK Support | Special Features |
|---|---|---|---|---|
| OpenAI | GPT-4, GPT-3.5, Embeddings, Vision, Audio | ✅ | ✅ | Function calling, streaming |
| Anthropic | Claude 4, Claude 3.5, Claude 3 | ✅ | ✅ | Prompt caching, tool use |
| Gemini 2.0, Gemini 1.5, Gemini Pro | ✅ | ✅ | Vision, function calling | |
| OpenAI Compatible | Any | ✅ | ✅ | Reasoning tokens, cache tracking |
# Single API key for all providers
OWLMETRIC_API_KEY=pk_your_project_key
# Your provider keys (stored on OwlMetric)
OPENAI_API_KEY=sk-your-openai-key
ANTHROPIC_API_KEY=sk-ant-your-anthropic-key
# Provider API keys (in your environment)
OPENAI_API_KEY=sk-your-openai-key
ANTHROPIC_API_KEY=sk-ant-your-anthropic-key
GEMINI_API_KEY=your-google-key
# OwlMetric tracking tokens (one per provider)
OWLMETRIC_OPENAI_TOKEN=pt_your_openai_token
OWLMETRIC_ANTHROPIC_TOKEN=pt_your_anthropic_token
OWLMETRIC_GEMINI_TOKEN=pt_your_gemini_token
import OpenAI from 'openai';
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
baseURL: 'https://owlmetric.com/api/proxy',
defaultHeaders: {
'x-owlmetric': process.env.OWLMETRIC_API_KEY,
}
});
const completion = await openai.chat.completions.create({
model: "gpt-4",
messages: [{ role: "user", content: "Hello!" }]
});
import OpenAI from "openai";
import { createTrackedClient } from "@owlmetric/tracker";
const client = createTrackedClient(OpenAI, {
apiKey: process.env.OPENAI_API_KEY,
owlmetricToken: process.env.OWLMETRIC_OPENAI_TOKEN,
});
const completion = await client.chat.completions.create({
model: "gpt-4",
messages: [{ role: "user", content: "Hello!" }]
});
import { openai } from "@ai-sdk/openai";
import { streamText } from "ai";
const result = streamText({
model: openai("gpt-4o"),
messages,
experimental_telemetry: {
isEnabled: true,
metadata: {
xOwlToken: process.env.OWLMETRIC_TOKEN,
},
},
});
// Before
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
});
// After (add 2 lines)
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
baseURL: 'https://owlmetric.com/api/proxy', // Add this
defaultHeaders: { // Add this
'x-owlmetric': process.env.OWLMETRIC_API_KEY, // Add this
} // Add this
});
This documentation is provided under the same license as the OwlMetric platform. See individual license files for SDK and library licenses.