@vrin/sdk is the official TypeScript client. It works in Node 18+, Bun, Deno, Cloudflare Workers, and modern browsers. Written in TypeScript, shipped as both ESM and CJS, fully typed.
If you’re building an agent in Python, use the Python SDK. If you’re shell-scripting, use the CLI.
Install
pnpm add, yarn add, bun add.
Authenticate
vrin_live_ (shared infra) or vrin_ent_ (enterprise-routed). Get one at vrin.cloud → Dashboard → API Keys.
If apiKey is omitted, the client reads VRIN_API_KEY from process.env.
First query
Constructor options
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | process.env.VRIN_API_KEY | Vrin API key. |
baseUrl | string | https://api.vrin.cloud | Override for staging or self-hosted deployments. |
timeoutMs | number | 120000 | Per-request timeout. Must be ≥ the slowest query you expect. |
maxRetries | number | 2 | Retry count for transient 5xx/network failures. |
fetch | typeof fetch | global fetch | Inject a custom fetch for runtimes that don’t have one (Node < 18, some edge environments). |
Usage across runtimes
- Node 18+
- Bun
- Cloudflare Workers
- Browser
Next steps
Querying
query, queryStream, response modes, depth.Knowledge
insert, uploadFile, polling async jobs.Conversations
Multi-turn sessions with
startConversation + continueConversation.Error handling
Typed exception hierarchy you can switch on.
Error handling
All errors extendVrinError. Import the specific subclasses you want to handle:
VrinError exposes:
message— human-readable descriptionstatus?— HTTP status, when relevantbody?— raw server payload, for logging
Custom fetch
For runtimes without a globalfetch (Node 16, some embedded envs) or when you want a middleware-style interceptor: