Getting Started
Quick Start (5 minutes)
Developer tracks their first event and reads a wallet balance in under 5 minutes.
Prerequisites#
- Node.js 18+ or Python 3.8+ installed
- A SettleSettle account (sign up free)
- A backend project to drop this into
Step 1 — Install the SDK#
Node.js#
bash
npm install settlesettle
# or
pnpm add settlesettlePython#
bash
pip install settlesettleStep 2 — Get your API key#
- Go to your SettleSettle Dashboard
- Click Create App
- Name your app (e.g. "My AI Tool")
- Copy the API key — it starts with
ss_live_
The raw API key is shown once only. Save it in your
.env immediately.Step 3 — Add it to your environment#
bash
# .env
SETTLESETTLE_API_KEY=ss_live_your_key_hereStep 4 — Initialize the SDK#
Node.js#
typescript
// lib/settle.ts
import { SettleSettle } from 'settlesettle'
if (!process.env.SETTLESETTLE_API_KEY) {
throw new Error('SETTLESETTLE_API_KEY is not set')
}
export const settle = new SettleSettle({
apiKey: process.env.SETTLESETTLE_API_KEY,
})Python#
python
# settle.py
from settlesettle import SettleSettle
# Reads SETTLESETTLE_API_KEY from environment automatically
settle = SettleSettle()Step 5 — Track your first event#
Node.js#
typescript
import { settle } from '@/lib/settle'
export async function handleAiQuery(userId: string, prompt: string) {
const result = await runAiModel(prompt)
// Tell SettleSettle this billable action happened
// Non-blocking — this never slows down your response
settle.events.track({
userId,
eventType: 'AI_QUERY',
})
return result
}Python#
python
from settle import settle
def handle_ai_query(user_id: str, prompt: str):
result = run_ai_model(prompt)
# Tell SettleSettle this billable action happened
# Non-blocking background event buffering
settle.events.track(user_id, "AI_QUERY")
return resultStep 6 — Check a user's wallet balance#
Node.js#
typescript
const { balance } = await settle.wallet.getBalance(userId)
if (balance <= 0) {
throw new Error('No credits remaining.')
}Python#
python
balance_info = settle.wallet.get_balance(user_id)
if balance_info.balance <= 0:
raise Exception("No credits remaining.")✅ Success state: Events appear in your SettleSettle dashboard under your app within seconds. Under the hood, all signals are dispatched straight to our secure API root at https://api.settlesettle.uno/v1.