Pricing and spend controls
A running sandbox is billed per second from your account’s credit. This page lists what you pay for, where to read the current rates, how to see what you have spent, and the settings that stop sandboxes and cap spend.
Current prices are on the pricing page.
What you pay for
| Charge | When it is billed | Where to read the rate |
|---|---|---|
| Compute | Per second while a sandbox runs, for its vCPUs, memory and disk, with an hourly minimum. Billing stops when the compute stops. | GET /v1/pricing/sandboxes |
| Egress | Outbound bytes beyond your plan’s monthly allowance, counted per account per UTC calendar month. Inbound traffic is free. | GET /v1/pricing/egress |
| Model use | Only when the coding agent calls models through the Tangle Router. On your own key or subscription, your provider bills you instead. | Tangle Router |
| GPU leases | While a lease is attached, up to the spend limit you set on it. | GPU leases |
Both pricing routes are public and need no API key:
curl -s https://sandbox.tangle.tools/v1/pricing/sandboxes
curl -s https://sandbox.tangle.tools/v1/pricing/egressThe sandbox rate card gives USD per vCPU-hour, per GB-hour of memory and per GB-hour of disk, and the hourly minimum. A sandbox costs vCPUs × cpuCoreHourUsd + memoryGB × memoryGBHourUsd + diskGB × diskGBHourUsd per hour, and never less than minChargeHourUsd.
The egress terms list each plan’s includedBytes and whether overage is billed at usdPerGb per 10^9 bytes or refused.
On a plan that refuses overage, new sandboxes and prompts are refused once the account reaches its allowance, and nothing is charged.
On a billed plan, a post-paid account is billed the overage when its sandbox stops. A prepaid account is refused new sandboxes and prompts until the next calendar month, and its balance is not drawn for the overage.
Refusal does not cut the network of a sandbox that is running.
Stopped sandboxes and snapshots
A stopped sandbox does not bill compute, disk and the hourly minimum included. It keeps its disk without charge until you delete it or until deleteAfterStoppedSeconds passes. An attached GPU lease bills until it is detached or its time cap passes.
Deleting a sandbox does not delete the snapshots you saved from it. They stay until you delete them; see Snapshots and forks.
Stop and delete sandboxes on a schedule
| Option | What happens |
|---|---|
idleTimeoutSeconds | Stops the sandbox after this long with no activity. The disk is kept. |
maxLifetimeSeconds | Stops the sandbox this long after create or resume, busy or not. The disk is kept. |
deleteAfterStoppedSeconds | Deletes a sandbox that has been stopped this long. The default is 30 days. |
Leave a timer out and the platform’s policy applies. The CLI sets --lifetime and --idle-timeout, in seconds, and defaults them to 3600 and 900.
import { Sandbox } from "@tangle-network/sandbox";
const client = new Sandbox({
apiKey: process.env.TANGLE_API_KEY!,
baseUrl: "https://sandbox.tangle.tools",
});
const box = await client.create({
idleTimeoutSeconds: 600,
maxLifetimeSeconds: 4 * 3600,
deleteAfterStoppedSeconds: 86_400,
metadata: { job: "nightly-review" },
});
try {
const result = await box.exec("nproc");
console.log(result.stdout);
} finally {
await box.delete();
}Delete every sandbox you create in a finally block. Timers stop a sandbox; only a delete or deleteAfterStoppedSeconds removes it.
Clean up by metadata
Tag the sandboxes a job creates, then delete them all in one call. In TypeScript:
import assert from "node:assert/strict";
import { Sandbox } from "@tangle-network/sandbox";
const client = new Sandbox({
apiKey: process.env.TANGLE_API_KEY!,
baseUrl: "https://sandbox.tangle.tools",
});
const runKey = `docs-${crypto.randomUUID()}`;
const box = await client.create({ agent: false, maxLifetimeSeconds: 300, metadata: { job: runKey } });
try {
const result = await client.deleteMatching({ metadataPrefix: { job: runKey } }, { cascade: true });
assert.equal(result.complete, true);
assert.equal(result.sandboxes.length, 1);
assert.equal(result.sandboxes[0].id, box.id);
assert.equal(result.sandboxes[0].confirmed, true);
console.log(result.complete, result.sandboxes[0].outcome);
} finally {
await box.delete();
}It deletes only your own sandboxes whose metadata values start with the prefixes you pass. result.complete is true once every match is confirmed gone, and the call is safe to repeat.
Pass { cascade: true } to delete branches with their parents. From Python or the CLI, call POST /v1/sandboxes/delete-matching.
Cap what can be spent
| Scope | How to cap it |
|---|---|
| An API key | tangle keys create ci-agents --budget-usd 25. Calls with the key are refused once it has spent its budget. |
| A fleet | policy.maxSpendUsd on client.fleets.create(). The fleet’s sandboxes charge a key with that budget; read it with fleet.spend(). See Fleets. |
| A GPU lease | maxSpendUsd and maxLifetimeSeconds, required on every lease. See GPU leases. |
Give each automation its own key with a budget. A runaway loop then stops at that key’s budget instead of using the account’s credit.
tangle keys create needs an API-key login; see API keys and tokens.
See what you have spent
import assert from "node:assert/strict";
import { Sandbox } from "@tangle-network/sandbox";
const client = new Sandbox({
apiKey: process.env.TANGLE_API_KEY!,
baseUrl: "https://sandbox.tangle.tools",
});
const usage = await client.usage();
const plan = await client.subscription();
assert(Number.isFinite(usage.computeMinutes));
assert(Number.isInteger(usage.activeSandboxes));
assert(Number.isFinite(plan.creditsAvailableUsd));
assert(Number.isFinite(plan.creditsUsedUsd));
console.log(usage.computeMinutes, usage.gpuCostUsd, usage.activeSandboxes);
console.log(plan.creditsAvailableUsd, plan.creditsUsedUsd);usage() covers the current UTC day: compute minutes, GPU seconds and GPU spend, and active and total sandboxes.
subscription() returns the plan, credit available and used, and the plan’s limits. creditsAvailableUsd can be negative on plans that allow overage.
The dashboard billing page shows the credit balance and account activity.
One sandbox’s egress this month, in TypeScript:
import assert from "node:assert/strict";
import { Sandbox } from "@tangle-network/sandbox";
const client = new Sandbox({
apiKey: process.env.TANGLE_API_KEY!,
baseUrl: "https://sandbox.tangle.tools",
});
const box = await client.create({ agent: false, maxLifetimeSeconds: 300 });
try {
const egress = await box.egress.usage();
assert(Number.isFinite(egress.bytes));
assert(Number.isFinite(egress.chargeUsd));
assert(Number.isFinite(egress.accountBytes));
console.log(egress.bytes, egress.chargeUsd, egress.accountBytes, egress.accountIncludedBytes);
} finally {
await box.delete();
}Model spend per turn
When the coding agent uses the Tangle Router, prompt() returns what the turn’s model calls cost:
const result = await box.prompt("Explain the build failure.");
console.log(result.costUsd);costUsd is model spend only, not compute. It is undefined when another turn on the same sandbox overlapped this one, or when the SDK cannot read your account’s ledger.
The SDK reads the ledger without extra setup when baseUrl is https://sandbox.tangle.tools.
With your own Claude or ChatGPT plan, model use goes to that plan and is not charged to your Tangle credit.
Next steps
- Limits and timeouts: plan limits and the API rate limit.
- Create, stop and delete: stop, resume and delete in detail.
- Fleets: many sandboxes under one budget.