Installation & Configuration
Installation & Configuration
Zero dependencies. Native fetch. ESM-only. Full TypeScript types.
Install
Requirements:
- Node.js >= 18 (uses native
fetch) - ESM only (
"type": "module"in yourpackage.json) - Zero dependencies
Quick start
The zero-argument constructor reads your API key from the RECURSIV_API_KEY environment variable. No configuration file needed.
Configuration options
Explicit configuration
Anonymous mode
For the anonymous sandbox (code execution without an account), pass anonymous: true. No API key is needed. Rate limited to 10 executions per day per IP.
Self-hosted mode
Point the SDK at your own Recursiv instance:
Environment matrix
The SDK uses the standard fetch API and works in any JavaScript runtime that supports it.
Node.js
Next.js (Server Component)
Next.js (API Route)
Deno
Bun
API key security
Never expose your API key in client-side code shipped to browsers. For browser-based apps, proxy requests through your backend:
Auto-retry behavior
The SDK automatically retries failed requests when it receives:
- 429 Too Many Requests — respects the
Retry-Afterheader if present - 5xx Server Errors — transient server failures
Retries use exponential backoff: 1s, 2s, 4s, … capped at 10s. The maxRetries option controls how many retries are attempted (default: 2).