Quickstart
What is Leap0?
Section titled “What is Leap0?”Leap0 is secure infrastructure for running AI-generated code. You start a sandbox from a template, call your running app over HTTP/SSE/WebSocket, interact with files and git, and delete the sandbox when done.
Create an account
Section titled “Create an account”Open the Leap0 app, create an account (or sign in).
Create an API key
Section titled “Create an API key”Generate an API key in the dashboard to authenticate requests to Leap0, then save it securely because it is shown only once and send it in the authorization header.
Install the SDK
Section titled “Install the SDK”pip install leap0npm install leap0Code example
Section titled “Code example”Walk through the full sandbox lifecycle: create, invoke, clone and inspect a repo, list files, and delete.
import os
import httpxfrom leap0 import Leap0Client
API_KEY = os.environ["LEAP0_API_KEY"]
client = Leap0Client()sandbox = client.sandboxes.create( vcpu=2, memory_mib=2048, timeout_min=30,)
try: response = httpx.get( sandbox.invoke_url("/<your-path>"), headers={"authorization": API_KEY}, ) response.raise_for_status() print(response.text)
cloned = sandbox.git.clone( url="https://github.com/octocat/Hello-World.git", path="/workspace/repo", branch="main", ) print(cloned.output)
git_status = sandbox.git.status(path="/workspace/repo") print(git_status.output)
files = sandbox.filesystem.ls(path="/workspace", recursive=False) print(len(files.items))finally: sandbox.delete()import { Leap0Client } from "leap0"
const apiKey = process.env.LEAP0_API_KEY ?? "<your-api-key>"const client = new Leap0Client()const sandbox = await client.sandboxes.create({templateName: "<your-template-name>",vcpu: 2,memoryMib: 2048,timeoutMin: 30,})
try {// 1. Invoke the sandboxconst invoke = await fetch(sandbox.invokeUrl("/<your-path>"), { headers: { authorization: apiKey },})console.log(await invoke.text())
// 2. Clone a repositoryconst cloned = await sandbox.git.clone({ url: "https://github.com/octocat/Hello-World.git", path: "/workspace/repo", branch: "main",})console.log(cloned.output)
// 3. Check git statusconst gitStatus = await sandbox.git.status("/workspace/repo")console.log(gitStatus.output)
// 4. List files in the sandboxconst files = await sandbox.filesystem.ls("/workspace")console.log(files.items.length)} finally {await sandbox.delete()await client.close()}