Typed error classes
The SDK exports concrete error classes mirroring Python: BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, RateLimitError, InternalServerError, APIConnectionError. instanceof branches let you write retry posture without parsing status codes.
maxRetries on the constructor
Pass maxRetries when constructing the client to control automatic retry behavior on 429/5xx for non-streaming calls. Default is 2. Tighter for fast-feedback CLIs; looser for long-running batch-style scripts.
Idempotency in TypeScript
Idempotency keys are passed via headers: { 'Idempotency-Key': key } in the per-call options. Use them for any expensive Opus-class generation where you want to retry safely after a network blip without double-billing.