# Compute classes

A compute class is the service level for your sandboxes and jobs: which servers the work runs on, how they are chosen and the price. It is a declared level of service, not a guaranteed speed.

## Classes

| Class | Runs on | Good for |
| --- | --- | --- |
| economy | the lowest-cost servers (default) | Python, small jobs, light AI tasks |
| balanced | balance of price, load and performance | everyday development, automation, browsers |
| performance | only servers with the highest measured performance (formerly `cpu-fast`) | builds, tests, heavy computation |
| memory | servers with the most free memory; at least 2 vCPU and 8 GB | data processing that needs a lot of RAM |
| dedicated | only servers reserved for your organization | enterprise workloads (on request) |

## Which class is used

`compute_class` in the request wins; without it your account's default class is used ( Settings → Compute Preferences ), and without a default `economy`. The server decides – SDKs and MCP send nothing when you don't set it. An unknown class is a `400` error, a class your plan does not include is `403`, a class that is temporarily unavailable is `409`. Your request is never moved to another class.

**Python**

```
from wbxsandbox import Sandbox, run_job, compute_preferences, set_default_compute_class

print(compute_preferences())                      # classes, prices, your default
set_default_compute_class("balanced")
run_job(command="make -j4", compute_class="performance", optimize_for="price", max_cost="0.10")
Sandbox.create(template="base", compute_class="memory")
```

**curl**

```
curl -s https://sandbox.wbx.cz/v1/compute/preferences -H "Authorization: Bearer YOUR_API_KEY"
curl -s -X PUT https://sandbox.wbx.cz/v1/compute/preferences -H "Authorization: Bearer YOUR_API_KEY" -d '{"default_compute_class": "balanced"}'
curl -s -X POST https://sandbox.wbx.cz/v1/jobs -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"command": "make -j4", "compute_class": "performance", "optimize_for": "price", "max_cost": "0.10"}'
```

## Price

Each class has its own price relative to your plan's rates (shown in Compute Preferences). The price of a sandbox or job is fixed when it is created or accepted – later changes of the price list or your default do not change running sandboxes or accepted jobs. The worst-case cost (`max_cost`, budget) uses the class price.

## Choosing a server inside the class

`optimize_for` (`price`, `balanced` or `performance`) picks the server *inside* the class; it never changes the class or its price. When no server of the class is free right now, creating a sandbox fails with `503` and a job waits in the queue. Responses include the resulting `compute_class` (jobs also `class_price`).

`placement` (`auto`, `fast`, `spread`) from earlier versions still works; `optimize_for` takes precedence.

Source: https://sandbox.wbx.cz/docs/jobs/compute
