Skip to main content
@karta.sh/sdk is a small, zero-dependency TypeScript client for managing your Karta account: API keys, BYOK provider keys, webhook endpoints, and reading usage and billing. It uses native fetch and ships full types.
This SDK manages your account. It does not send chat messages - for sessions and streaming, call the HTTP API directly, or hit your agent through a consumer adapter with the OpenAI or Anthropic SDK.

Install & construct

Requires Node >= 18.17 (for native fetch). Every 4xx/5xx throws a typed error (KartaAuthError, KartaForbiddenError, KartaNotFoundError, KartaValidationError) carrying status and the parsed body.

API keys

Model keys (BYOK)

Providers: anthropic, openai, bedrock, vertex, openrouter, xai, and google. Connector creation accepts an optional HTTPS endpoint_url and an explicit api_format. See BYOK.

Webhook endpoints

update only re-enables a disabled endpoint; event types are set at create. The returned secret (a whsec_...) verifies inbound signatures - see Webhooks.

Usage & billing

See Usage & budgets.

Full example