Skip to content

An open-source, faster Devin alternative

TypeScript

Add 1GB pricing tier and update all tier prices (#105)

Mohamed Habib552944601132
diff --git a/docs/api-reference/sandboxes/create.mdx b/docs/api-reference/sandboxes/create.mdx
index ef78ebab..c5e0fea1 100644
--- a/docs/api-reference/sandboxes/create.mdx
+++ b/docs/api-reference/sandboxes/create.mdx
@@ -18,19 +18,22 @@ Create a new sandbox.
</ParamField>
<ParamField body="memoryMB" type="integer">
- Memory in MB. Must match an allowed tier: `4096`, `8192`, `16384`, `32768`, or `65536`. If omitted but `cpuCount` is set, inferred automatically.
+ Memory in MB. Must match an allowed tier: `1024`, `4096`, `8192`, `16384`, `32768`, or `65536`. If omitted but `cpuCount` is set, inferred automatically.
</ParamField>
The allowed CPU/memory combinations are:
| Memory | vCPU |
| --- | --- |
+| 1024 MB (1 GB) | 1 |
| 4096 MB (4 GB) | 1 |
| 8192 MB (8 GB) | 2 |
| 16384 MB (16 GB) | 4 |
| 32768 MB (32 GB) | 8 |
| 65536 MB (64 GB) | 16 |
+The 1 GB tier provides 1 vCPU on a best-effort basis. For guaranteed CPU allocation, use the 4 GB tier or above.
+
If both `cpuCount` and `memoryMB` are provided, they must match one of these tiers.
<ParamField body="envs" type="object">
diff --git a/docs/reference/typescript-sdk.mdx b/docs/reference/typescript-sdk.mdx
index 43f042ad..e423d704 100644
--- a/docs/reference/typescript-sdk.mdx
+++ b/docs/reference/typescript-sdk.mdx
@@ -33,8 +33,8 @@ Create a new sandbox.
| `apiUrl` | string | env var | API URL |
| `envs` | Record\<string, string\> | — | Environment variables |
| `metadata` | Record\<string, string\> | — | Arbitrary metadata |
-| `cpuCount` | number | — | CPU cores (max 4) |
-| `memoryMB` | number | — | Memory in MB (max 2048) |
+| `cpuCount` | number | — | CPU cores (1, 2, 4, 8, or 16) |
+| `memoryMB` | number | — | Memory in MB (1024, 4096, 8192, 16384, 32768, or 65536) |
| `image` | Image | — | Declarative image definition (see [Image](#image)) |
| `snapshot` | string | — | Name of a pre-built snapshot |
| `onBuildLog` | `(log: string) => void` | — | Build log callback (when using `image`) |
diff --git a/docs/sandboxes/elasticity.mdx b/docs/sandboxes/elasticity.mdx
index b9a4bcb4..05525732 100644
--- a/docs/sandboxes/elasticity.mdx
+++ b/docs/sandboxes/elasticity.mdx
@@ -25,6 +25,7 @@ CPU is adjusted proportionally — you only need to specify memory. The permissi
| Memory | vCPU |
| --- | --- |
+| 1GB | 1 (best-effort) |
| 4GB | 1 |
| 8GB | 2 |
| 16GB | 4 |
diff --git a/internal/api/sandbox.go b/internal/api/sandbox.go
index 6df8a009..9e1ed788 100644
--- a/internal/api/sandbox.go
+++ b/internal/api/sandbox.go
@@ -27,7 +27,7 @@ func (s *Server) createSandbox(c echo.Context) error {
}
// Validate CPU/memory against allowed tiers.
- // Allowed tiers (memoryMB → vCPU): 4096→1, 8192→2, 16384→4, 32768→8, 65536→16.
+ // Allowed tiers (memoryMB → vCPU): 1024→1, 4096→1, 8192→2, 16384→4, 32768→8, 65536→16.
if err := types.ValidateResourceTier(&cfg); err != nil {
return c.JSON(http.StatusBadRequest, map[string]string{
"error": err.Error(),
diff --git a/internal/billing/pricing.go b/internal/billing/pricing.go
index 90c94c41..816b98fb 100644
--- a/internal/billing/pricing.go
+++ b/internal/billing/pricing.go
@@ -6,15 +6,17 @@ import (
// TierPricePerSecond maps memory_mb → USD per second.
var TierPricePerSecond = map[int]float64{
- 4096: 0.00003240740741, // 4GB / 1 vCPU
- 8192: 0.000150462963, // 8GB / 2 vCPU
- 16384: 0.0008101851852, // 16GB / 4 vCPU
- 32768: 0.005787037037, // 32GB / 8 vCPU
- 65536: 0.0162037037, // 64GB / 16 vCPU
+ 1024: 0.000001080246914, // 1GB / 1 vCPU
+ 4096: 0.000005787037037, // 4GB / 1 vCPU
+ 8192: 0.000005015432099, // 8GB / 2 vCPU
+ 16384: 0.00002700617284, // 16GB / 4 vCPU
+ 32768: 0.0001929012346, // 32GB / 8 vCPU
+ 65536: 0.0005401234568, // 64GB / 16 vCPU
}
// TierMetadataKey maps memory_mb → Stripe metadata key for price lookup.
var TierMetadataKey = map[int]string{
+ 1024: "sandbox_1gb",
4096: "sandbox_4gb",
8192: "sandbox_8gb",
16384: "sandbox_16gb",
diff --git a/pkg/types/sandbox.go b/pkg/types/sandbox.go
index 50932265..ff4c3d14 100644
--- a/pkg/types/sandbox.go
+++ b/pkg/types/sandbox.go
@@ -85,6 +85,7 @@ type ResourceTier struct {
// AllowedResourceTiers lists the valid memory→vCPU combinations.
var AllowedResourceTiers = []ResourceTier{
+ {MemoryMB: 1024, VCPUs: 1},
{MemoryMB: 4096, VCPUs: 1},
{MemoryMB: 8192, VCPUs: 2},
{MemoryMB: 16384, VCPUs: 4},
@@ -103,7 +104,7 @@ func ValidateMemoryMB(memoryMB int) (vcpus int, err error) {
return t.VCPUs, nil
}
}
- return 0, fmt.Errorf("memoryMB must be one of: 4096, 8192, 16384, 32768, 65536 (got %d)", memoryMB)
+ return 0, fmt.Errorf("memoryMB must be one of: 1024, 4096, 8192, 16384, 32768, 65536 (got %d)", memoryMB)
}
// ValidateCPUCount checks that cpuCount matches an allowed tier and returns the corresponding memoryMB.
@@ -148,7 +149,7 @@ func ValidateResourceTier(cfg *SandboxConfig) error {
return nil
}
}
- return fmt.Errorf("cpuCount %d and memoryMB %d do not match an allowed tier; valid combinations: 1/4096, 2/8192, 4/16384, 8/32768, 16/65536", cfg.CpuCount, cfg.MemoryMB)
+ return fmt.Errorf("cpuCount %d and memoryMB %d do not match an allowed tier; valid combinations: 1/1024, 1/4096, 2/8192, 4/16384, 8/32768, 16/65536", cfg.CpuCount, cfg.MemoryMB)
}
// SandboxListResponse is the response for listing sandboxes.
diff --git a/web/src/pages/Billing.tsx b/web/src/pages/Billing.tsx
index e2c9b933..4db03c85 100644
--- a/web/src/pages/Billing.tsx
+++ b/web/src/pages/Billing.tsx
@@ -6,11 +6,12 @@ import {
} from '../api/client'
const PRICING_TIERS = [
- { memory: '4 GB', vcpus: 1, perSec: 0.00003240740741 },
- { memory: '8 GB', vcpus: 2, perSec: 0.000150462963 },
- { memory: '16 GB', vcpus: 4, perSec: 0.0008101851852 },
- { memory: '32 GB', vcpus: 8, perSec: 0.005787037037 },
- { memory: '64 GB', vcpus: 16, perSec: 0.0162037037 },
+ { memory: '1 GB', vcpus: 1, bestEffort: true, perSec: 0.000001080246914 },
+ { memory: '4 GB', vcpus: 1, perSec: 0.000005787037037 },
+ { memory: '8 GB', vcpus: 2, perSec: 0.000005015432099 },
+ { memory: '16 GB', vcpus: 4, perSec: 0.00002700617284 },
+ { memory: '32 GB', vcpus: 8, perSec: 0.0001929012346 },
+ { memory: '64 GB', vcpus: 16, perSec: 0.0005401234568 },
]
export default function Billing() {
@@ -69,7 +70,7 @@ export default function Billing() {
<span style={{ fontSize: 12, color: 'var(--text-tertiary)' }}>
{isPro
? `${billing?.maxConcurrentSandboxes ?? 5} concurrent sandboxes, all tiers`
- : `${billing?.maxConcurrentSandboxes ?? 5} concurrent sandboxes, 4GB / 1 vCPU`}
+ : `${billing?.maxConcurrentSandboxes ?? 5} concurrent sandboxes, up to 4GB / 1 vCPU`}
</span>
</div>
@@ -195,7 +196,7 @@ export default function Billing() {
<td style={{ fontWeight: 600, color: 'var(--text-primary)' }}>
{t.memory}{locked && ' — Pro'}
</td>
- <td>{t.vcpus}</td>
+ <td>{t.vcpus}{('bestEffort' in t) && <span style={{ fontSize: 10, color: 'var(--text-tertiary)', marginLeft: 4 }}>best-effort</span>}</td>
<td style={{ fontFamily: 'var(--font-mono)', fontSize: 12, color: locked ? 'var(--text-tertiary)' : 'var(--accent-cyan)' }}>
${t.perSec.toFixed(11)}
</td>