@pymthouse/builder-sdk is the official TypeScript/npm SDK for PymtHouse app builders. It wraps:
- Confidential Builder and Usage REST APIs (M2M auth, user provisioning, billing)
- OIDC protocol flows (token mint, exchange, device login, JWT verify) via
oauth4webapi
- Signer integration (direct DMZ proxy and identity webhook for go-livepeer)
- Client-safe utilities (config checks, device-initiate validation, formatting, plan pricing math)
Install
Node ≥ 20 required.
Quick start
From environment variables (recommended for server use)
Explicit construction
Environment variables
The env subpath reads these variables. Set them in your backend environment or secret manager.
The @pymthouse/builder-sdk/env subpath throws immediately if imported in a browser context (detects globalThis.window). In Next.js, add import "server-only" in any file that re-exports createPmtHouseClientFromEnv to enforce the server-only constraint at build time.
PmtHouseClient method reference
All REST calls use HTTP Basic auth against {issuerOrigin}/api/v1/apps/{publicClientId}/….
Discovery & OIDC
User management
Token minting & exchange
Device flow
Usage & billing
Signer routing
Subpath exports
Common usage patterns
Mint a signer session for a user
Check usage balance before signing
Approve a device login (Option B)
Usage BFF rollup
Next.js server-only guard
Import createPmtHouseClientFromEnv only from this wrapper in Route Handlers or Server Actions.