HomeAPIs › E2B

E2B sandbox API — pricing, free tier & how to get a key

E2B gives an AI agent a real Linux sandbox to run code in — the standard answer to "my model wrote a script, now what executes it". Billing is per second of sandbox lifetime rather than per request, which makes it cheap for short bursts and expensive in exactly one way people keep discovering the hard way.

E2B pricing (reference, July 2026)

ItemRateRoughlyNotes
2 vCPU sandbox (default)$0.000028 / s≈ $0.10 / hourWall-clock lifetime, not CPU time
RAM$0.0000045 / GiB / s≈ $0.016 / GiB / hourAdded on top of vCPU
Storage$010 GiB Hobby, 20 GiB ProFree within the allowance
Pro plan$150 / month24-hour sessionsMore concurrency, custom CPU/RAM
⚠️ Reference prices, July 2026 — E2B changes plans and rates without much notice. Confirm on the official pricing page before budgeting. · Report outdated price →
✓ Last verified: 2026-07-23· Source: official provider pricing page· Auto-monitored — report change →

→ Estimate your bill on the API cost calculator or model a whole app with the AI app cost estimator.

Is there a free tier?

Yes, and it is unusually generous. The Hobby plan costs nothing, requires no card, and includes a one-time $100 usage credit, sessions up to one hour, and 20 concurrent sandboxes. At roughly $0.10 an hour per sandbox, $100 of credit is about a thousand sandbox-hours — far more than a prototype needs. See how it compares on the free API tiers page.

How to get a E2B API key (step by step)

1. Sign up at e2b.dev — no card needed for Hobby.
2. Open the dashboard and copy your API key.
3. Export it as E2B_API_KEY; the Python and JS SDKs pick it up automatically.
4. Close sandboxes explicitly when a task ends — this is the whole cost story.

Test it:

# install (export E2B_API_KEY first)
pip install e2b-code-interpreter

# python — note the explicit close
from e2b_code_interpreter import Sandbox
sbx = Sandbox()
print(sbx.run_code("print(6*7)").logs)
sbx.kill() # stops the meter

What drives the bill

Not compute — lifetime. A sandbox that exists for three seconds costs about a hundredth of a cent; the same sandbox left open until a one-hour timeout costs the full ten cents, having done nothing for fifty-nine minutes and fifty-seven seconds of it. In an agent loop that spawns a sandbox per step, the difference between explicit teardown and timeout-based cleanup is most of your bill. Model the whole agent loop with the agent loop budget calculator, or the per-step economics with the agent step cost calculator.

FAQ

How much does E2B cost?

Reference pricing (July 2026): sandboxes bill per second of lifetime — a default 2 vCPU sandbox is about $0.000028 per second, roughly $0.10 an hour, plus RAM at about $0.0000045 per GiB per second. Storage is included free up to 10 GiB on Hobby and 20 GiB on Pro. The Pro plan is $150 a month and mainly buys longer sessions, more concurrency and configurable CPU and RAM.

Does E2B have a free tier?

Yes. The Hobby plan is free, needs no credit card, and comes with a one-time $100 usage credit, sessions up to one hour, and up to 20 concurrent sandboxes. For most prototypes that credit lasts a long time, because a per-second sandbox that only lives for a few seconds per task costs a fraction of a cent.

Why is my E2B bill higher than the compute I used?

Because the meter runs on sandbox existence, not on execution. An idle sandbox you forgot to close bills at the same rate as one running a workload. The single most effective cost control is closing sandboxes explicitly when a task finishes rather than letting them run to the session timeout — the difference between a two-second lifetime and a one-hour timeout is a factor of eighteen hundred.

How do I get an E2B API key?

Sign up at e2b.dev, open the dashboard and copy the API key from the keys section. The Hobby tier and its $100 credit are active immediately; the SDKs for Python and JavaScript take the key from the E2B_API_KEY environment variable.

Not affiliated with E2B. Prices are reference estimates — always verify on the official pricing page.

Host your project:DigitalOcean — $200 free ↗Hostinger VPS

Exchanges

BybitBinanceOKXKuCoinBitgetGate.ioMEXC

Tools & Hosting

📈 TradingView🔒 NordVPN💳 RevolutDigitalOcean $200Hostinger