SourceB · Customer API
Pricing API
Give your product evidence-backed model costs. Integer token math, fail-closed stale prices, zero LLM on the hot path. Free keys available now — paid entitlement tiers are not activated yet.
1. Get an API key
Mint a free key for customer integrations. Store the secret once — we only keep a hash.
2. List models
curl -s https://sourceb.app/api/pricing/models \
-H "Authorization: Bearer sbpk_live_YOUR_KEY"3. Calculate cost
curl -s https://sourceb.app/api/pricing/calculate \
-H "Authorization: Bearer sbpk_live_YOUR_KEY" \
-H "content-type: application/json" \
-d '{
"modelSlug": "gpt-4o-mini",
"inputTokens": 1000000,
"cachedInputTokens": 0,
"outputTokens": 200000
}'Endpoints
GET /api/pricing/models— catalog + evidencePOST /api/pricing/calculate— deterministic totalsPOST /api/pricing/keys— mint free customer keyGET /api/pricing/openapi— OpenAPI 3 spec
Auth: Authorization: Bearer … or X-SourceB-Api-Key. CORS is enabled for browser apps. Anonymous calls work for the public calculator; customer products should use a key.