All three are Apache-2.0 licensed.
What every SDK does
- Verify first. Every entry point verifies the
zc-signatureheader before anything else. The signature is an HMAC-SHA256 over the raw request bytes. The SDK never checks an allowance for an unverified request. - Decisions, not exceptions. A guard returns an allow decision with the verified buyer context, or a deny decision that carries the exact response to return:
401for a bad signature, the402 payment_requiredrefusal for a business denial, or503under a fail-closed outage policy. Malformed configuration and API failures raise typed errors instead. - Fail open by default. If the allowance check fails without a usable answer, the configurable outage policy decides:
allow(default),deny, orthrow. A recognizedallowed: falseis always a402. The policy applies only after a signature verifies, so an unverified request is never served because the allowance API was down. The SDKs differ in how strictly they classify failures. The Go SDK treats any 4xx from the allowance API (a revoked key, an unknown service) as a hard error, never an outage. The TypeScript and Python SDKs route API errors through the policy. Each SDK’s errors page documents its exact classification. - Settle on success only. Synchronous usage rides the
zc-usageresponse header on 2xx responses; asynchronous usage goes throughreportUsagewith a seller-owned, derived idempotency key. No SDK retries automatically or invents idempotency keys. - Split usage keys. Pass one API key with both usage scopes, or a read key for guards and checks plus a write key for reporting. The split is useful when a separate worker reports usage.
Differences that matter
Pick the SDK that matches your backend language. The core guard flow has the same capabilities in all three. If your backend is in another language entirely, the REST walkthrough implements the same contract with plain HTTP.
Get started
TypeScript
Web-native guard for Node.js and edge runtimes.
Python
Sync and async clients with ASGI and WSGI adapters.
Go
Standard middleware for net/http and friends.