Documentation
Isolated virtual machines for AI agents. One API call to create, one to destroy. Every sandbox boots in under a second and runs its own kernel.
import { Sandbox } from '@omnirun/sdk';
const sandbox = await Sandbox.create('playground', {
timeout: 300,
});
// sandbox.sandboxId → "sb_a1b2c3d4"Quick Start
Go from zero to running code in an isolated VM. Each step builds on the previous. The entire flow takes about 60 seconds.
Run in playground →npm install @omnirun/sdkawait sandbox.files.write('/tmp/data.csv', content)await sandbox.kill()TypeScript SDK
Install the SDK and set your API key. The SDK automatically reads OMNIRUN_API_KEY from your environment.
All methods return typed responses. The SDK supports both ESM and CommonJS.
Run in playground →npm install @omnirun/sdkREST API
All endpoints require a Bearer token. Base URL: https://api.omnirun.io
| Method | Endpoint | Description |
|---|---|---|
| Sandboxes | ||
| POST | /sandboxes | Create a new sandbox |
| GET | /sandboxes | List active sandboxes |
| GET | /sandboxes/:id | Get sandbox status |
| DELETE | /sandboxes/:id | Terminate sandbox |
| Commands | ||
| POST | /sandboxes/:id/commands | Run a command |
| GET | /sandboxes/:id/commands | List executed commands |
| Files | ||
| POST | /sandboxes/:id/files | Upload a file |
| GET | /sandboxes/:id/files | Read a file (path as query param) |
| Exposures | ||
| POST | /sandboxes/:id/exposures | Expose a port with preview URL |
| GET | /sandboxes/:id/exposures | List active exposures |
| DELETE | /sandboxes/:id/exposures/:eid | Remove an exposure |
| LLM Proxy | ||
| POST | /llm/v1/chat/completions | OpenAI-compatible chat completion |
| GET | /llm/v1/models | List available models |
| GET | /llm/v1/usage | Get spend tracking info |
| Vault | ||
| POST | /vault/init | Initialize user vault |
| POST | /vault/credentials | Store a credential |
| GET | /vault/credentials | List stored credentials |
| Auth | ||
| POST | /auth/magic-link/request | Request a magic link email |
| POST | /auth/otp/verify | Verify OTP code |
| GET | /auth/me | Get current user info |
| POST | /auth/tokens | Create an API token |
| History | ||
| GET | /sandboxes/history | List past sandbox sessions |
Platform
Secure credential storage with per-user isolation. Store API keys and secrets in your vault, then inject them into sandboxes at creation time.
When vaultInject: true is set, all vault credentials are written to /tmp/.omnirun-env inside the sandbox and automatically sourced by the agent process. Vault sandboxes are exempt from idle auto-kill.
curl -X POST https://api.omnirun.io/vault/init \
-H "Authorization: Bearer $OMNIRUN_KEY"
// Auto-created on first logincurl -X POST https://api.omnirun.io/vault/credentials \
-H "Authorization: Bearer $OMNIRUN_KEY" \
-d '{"key": "OPENAI_API_KEY",
"value": "sk-..."}'const sandbox = await Sandbox.create('playground', {
vaultInject: true,
});
// Credentials written to /tmp/.omnirun-env
// Auto-sourced by the sandbox agentPlatform
Each user can run up to 3 concurrent sandboxes by default. Creating a sandbox beyond this limit returns a 429 status code.
Sandboxes with no activity for 15 minutes are automatically killed. Sandboxes created with vaultInject: true are exempt from idle auto-kill.
// Concurrent sandbox limit: 3 per user
// Exceeding the limit returns HTTP 429
POST /sandboxes
// → 429 { "error": "concurrent sandbox limit reached" }
// Idle auto-kill: 15 minutes with no activity
// Vault-injected sandboxes are exemptPlatform
All sandboxes start with default-deny networking. No outbound connections are allowed unless you explicitly configure an allow list.
This prevents data exfiltration and ensures sandboxed code can only reach services you approve.
Read security model →const sandbox = await Sandbox.create('agent', {
network: {
allow: [
'api.openai.com',
'api.anthropic.com',
'huggingface.co',
]
}
});
// sandbox can only reach these 3 hosts
// all other outbound traffic is blockedPlatform
Templates define the pre-installed packages and base configuration for a sandbox. Use built-in templates or create your own.
Try playground templates →// Built-in templates
'playground' // General purpose
'rust' // Rust toolchain
'typescript' // Node.js + TS
'javascript' // Node.js
'php' // PHP 8.x
'sql' // PostgreSQL
'zig' // Zig compiler
// Custom template
const sb = await Sandbox.create('my-custom-template');Reference
MicroVM boot times compared to traditional containers and full VMs. OmniRun sandboxes boot in under a second.
Median of cold-start measurements on Hetzner AX102 bare metal. 1,000 runs.