Skip to main content
@nozle-js/node requires Node.js 18 or later and uses the built-in Fetch API. Entity subscription APIs are introduced in 0.5.0.

Create a client

Configuration

Set both URLs explicitly outside local development. Trailing slashes are removed automatically.
This package is server-only. Never bundle an sk_, master key, or internal credential into browser code. Use @nozle-js/react with a publishable key for public catalog reads.

Verify connectivity

API surface

API and billing

Namespaces

The package also exports wrapOpenAI() and wrapAnthropic() for token metadata capture.

Key behavior

  • Billing mutations and settlement transitions require an API key beginning with sk_.
  • Entity mutations, credit transfers, and usage.track() reject publishable pk_ keys.
  • Mutation idempotency keys are caller-supplied and limited to 255 bytes.
  • Product-credit amounts are exact decimal strings, not JavaScript numbers.
  • Failed HTTP responses reject with an Error containing the operation and HTTP status.
  • Every request uses AbortSignal.timeout(timeout).

Production pattern

Create one client per process and reuse it:
Do not accept authoritative customerId, Entity IDs, plan codes, return origins, or idempotency keys blindly from a browser. Derive or validate them in your trusted backend.

Next steps