Per-Second Billing for Code Execution and Sandboxes
Bill for compute time, not flat fees. Wrap E2B, Modal, AWS Lambda, or any sandbox with per-second metering and automatic budget enforcement.
How it works
import { settlegrid } from '@settlegrid/mcp'
const sg = settlegrid.init({
toolSlug: 'my-sandbox',
pricing: { model: 'per-second', costPerSecondCents: 0.5 },
})
const billedExecution = sg.wrap(async (args: { code: string; language: string }) => {
const startTime = Date.now()
const result = await e2b.runCode(args.code, { language: args.language })
const durationMs = Date.now() - startTime
return {
content: [{ type: 'text', text: result.output }],
_meta: { durationMs },
}
})Supported providers
SettleGrid works with any provider. Here are the most common ones for code execution & sandboxes.
| Provider | Pricing |
|---|---|
| E2B | Firecracker sandboxes -- per-second compute |
| Modal | Serverless GPU/CPU -- per-second billing |
| Daytona | Dev environments -- per-minute billing |
| Vercel Sandbox | Edge compute -- per-invocation |
| AWS Lambda | Serverless functions -- per-ms billing |
| Blaxel | Managed sandboxes -- per-second compute |
Why per-second billing?
Code execution pricing should reflect actual compute consumed. Per-second billing is fairer than per-invocation because a 200ms script costs less than a 30-second data pipeline. SettleGrid reads the durationMs metadata from your response and bills accordingly, supporting both CPU and GPU rate cards.
$500M-1B
Total Addressable Market
6
Supported Providers
2 min
Setup Time
Frequently asked questions
How does per-second billing work with SettleGrid?
Can I charge different rates for GPU vs CPU?
What happens if code execution times out?
Is there a maximum execution time?
Start billing code execution & sandboxes today
Add per-second billing to your code execution & sandboxes service in under 2 minutes. No upfront costs, no contracts.