Documentation
Quick start
- Sign up and create an app to get your
apm_key - Install the SDK — 2 lines, then every AI call is tracked automatically
- View costs, tokens, and profit per user in your dashboard
Node.js SDK
@statero/sdk auto-instruments OpenAI, Anthropic, Google Gemini, Groq, Mistral, and Cohere. Just init() + patch() — zero code changes to your AI calls.
# 1. Add to .npmrc (use your real apm_ key)
@statero:registry=https://api.statero.app/npm/
//api.statero.app/npm/:_authToken=apm_your_key
npm install @statero/sdk
# 2. Add at app startup (index.js / server.ts)
import statero from "@statero/sdk";
statero.init({ apiKey: "apm_...", host: "https://api.statero.app" });
statero.patch(); // auto-instruments all AI providers
# 3. Use your AI SDK as usual — everything is tracked
import OpenAI from "openai";
const client = new OpenAI();
const res = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello" }],
});
// tokens, cost, model, provider sent to Statero automaticallyPython SDK
statero — same auto-instrumentation, same 6 providers. Hosted on the Statero pip registry.
# 1. Install
pip install statero \
--index-url https://api.statero.app/pip/ \
--extra-index-url https://pypi.org/simple/
# 2. Add at app startup
import statero
statero.init(api_key="apm_...", host="https://api.statero.app")
statero.patch() # auto-instruments all AI providers
# 3. Use your AI SDK as usual — everything is tracked
import openai
client = openai.OpenAI()
res = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
)
# tokens, cost, model, provider sent to Statero automaticallyContext & tags
Set context once — user, feature, session, tags. All subsequent AI calls inherit it automatically.
// Set context once — all AI calls inherit it
statero.setContext({
userId: "user_123",
feature: "chat",
sessionId: "sess_abc",
tags: ["premium"],
metadata: { plan: "pro" },
});Supported providers
| Provider | Chat | Stream | Embed | Images | Audio |
|---|---|---|---|---|---|
| OpenAI | ✅ | ✅ | ✅ | ✅ | ✅ |
| Anthropic | ✅ | ✅ | — | — | — |
| Google Gemini | ✅ | ✅ | ✅ | — | — |
| Groq | ✅ | ✅ | — | — | ✅ |
| Mistral | ✅ | ✅ | ✅ | — | — |
| Cohere | ✅ | ✅ | ✅ | — | — |
Auto pricing
Cost is auto-calculated for 243 models across all supported providers. No manual pricing setup required — just use any model and Statero handles the rest.
Full catalog: GET https://api.statero.app/v1/models/supported
What gets tracked
- model — gpt-4o, claude-sonnet-4-6, gemini-2.5-flash...
- provider — auto-detected from SDK class
- input_tokens / output_tokens — from usage metadata
- cached_tokens — prompt cache hits (OpenAI, Anthropic, Gemini)
- reasoning_tokens — chain-of-thought (o1, o3, Gemini thinking)
- duration_ms — request latency
- finish_reason — stop, length, tool_calls...
RevenueCat
Connect RevenueCat to see subscription revenue, profit and margin per user.
Webhook URL (per app): https://api.statero.app/v1/webhooks/revenuecat/<project_id>
Copy the exact URL from your app Setup tab.
Important: use the same user ID in:
statero.setContext({ userId: "user_123" }) // SDK
RevenueCat app_user_id = "user_123"React Native consent
@statero/consent — Apple 5.1.2(i) compliance.
@statero:registry=https://api.statero.app/npm/
//api.statero.app/npm/:_authToken=apm_your_key
npm install @statero/consent
import { initConsent } from "@statero/consent";
import { ConsentProvider, useConsent } from "@statero/consent/react";
initConsent({ apiKey: "apm_..." });
function App() {
return (
<ConsentProvider>
<YourApp />
</ConsentProvider>
);
}
// useConsent().grant(["openai"], { userId: "user_123", appId: "com.example.app" })Managing apps
Each app has its own API key and metrics. Open an app from the sidebar, then use Settings to update expected models or delete the app.