Documentation
Get per-customer attribution running in 5 minutes.
Sign up at costr.dev/signup. Free tier covers $25/mo of tracked spend. No card required.
After sign-up, create an API key in the dashboard. It starts with cs_.
Change your LLM client baseURL from the provider URL to the Costr proxy. Your provider key stays in apiKey — Costr never sees or stores it in plaintext.
OpenAI
const client = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
baseURL: 'https://costr.dev/api/proxy/openai',
defaultHeaders: {
'x-costr-key': 'cs_YOUR_KEY',
'x-costr-user': userId, // your customer's ID
},
})Anthropic
const client = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
baseURL: 'https://costr.dev/api/proxy/anthropic',
defaultHeaders: {
'x-costr-key': 'cs_YOUR_KEY',
'x-costr-user': userId,
},
})Google Gemini
const client = new GoogleGenerativeAI(process.env.GOOGLE_API_KEY, {
baseUrl: 'https://costr.dev/api/proxy/google',
customHeaders: {
'x-costr-key': 'cs_YOUR_KEY',
'x-costr-user': userId,
},
})Set x-costr-user to whatever ID you use to identify your customer — a Stripe customer ID, your own UUID, an email address. Costr uses it to group all AI calls under that customer in your dashboard.
This is the only attribution you need to add. Everything else — token counts, cost, model, latency, provider — is captured automatically.
Make a test API call. Within a few seconds you will see it appear in your dashboard with cost, model, and the customer ID you passed.
What Costr captures
x-costr-feature)Costr never stores prompt content or response bodies. Only metadata.
Questions? Email brandon@costr.dev