Install the SDK
Choose your language:
TypeScript / Node.js
npm install @aicostguard/sdk
Python
pip install aicostguard
Get Your API Key
Wrap Your LLM Client
TypeScript
import { CostGuard } from '@aicostguard/sdk';
import OpenAI from 'openai';
const guard = new CostGuard({ apiKey: 'cg_your_key_here' });
const openai = guard.wrap(new OpenAI());
// Use openai exactly as before — costs are tracked automatically
const chat = await openai.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello!' }],
});
Python
from aicostguard import CostGuard
from openai import OpenAI
guard = CostGuard(api_key="cg_your_key_here")
client = guard.wrap(OpenAI())
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}]
)
View Your Dashboard
Visit aicostguard.com/dashboard to see your costs in real time.