Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Official @jazadev/node SDK — create customers, mint client sessions, consume credits with optional override, and verify webhooks.
npm install @jazadev/node
import { Jaza } from '@jazadev/node'; const jaza = new Jaza({ secretKey: process.env.JAZA_SECRET_KEY!, // jz_test_sk_… or jz_live_sk_… publicKey: process.env.JAZA_PUBLIC_KEY!, // jz_test_pk_… or jz_live_pk_… // apiBaseUrl: 'http://localhost:3001', // local jaza-api only });
{ secretKey, publicKey }
{ apiKey }
createCustomer({ name, email?, phoneNumber? })
cus_…
getCustomer(customerId)
init({ customerId })
consume({ customerId, featureCode?, credits?, idempotencyKey })
getBalance({ customerId })
balanceCredits
topUp({ customerId })
check({ topUpId })
webhooks.constructEvent(rawBody, signature, secret)
JazaError
statusCode
code
raw
const customer = await jaza.createCustomer({ name: 'Amina Okello', email: 'amina@example.com', }); // store customer.id on your user
const init = await jaza.init({ customerId: customer.id }); // return init from POST /api/jaza/init → JazaProvider getSession
featureCode
creditsCost
credits
await jaza.consume({ customerId: customer.id, featureCode: 'SEND_MESSAGE', idempotencyKey: `msg_${messageId}`, });
await jaza.consume({ customerId: customer.id, featureCode: 'AI_CHAT', credits: 42, idempotencyKey: `ai_${jobId}`, });
await jaza.consume({ customerId: customer.id, credits: 10, idempotencyKey: `adj_${id}`, });
const event = jaza.webhooks.constructEvent( rawBody, req.headers['jaza-signature'], process.env.JAZA_WEBHOOK_SECRET!, );
constructEvent
WEBHOOK_EVENT_TYPES
const wallet = await jaza.getBalance({ customerId: customer.id }); // Advanced: host-minted top-up JWT — prefer client session top-up in the client SDK const session = await jaza.topUp({ customerId: customer.id }); await jaza.check({ topUpId: session.id });