# Compute classes

A compute class is the service level for your sandboxes and jobs: which servers the work runs on and what it costs. Most people never change it – the default `economy` is fine for Python, scripts and light AI tasks. 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 | 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) |

## Choose a class

`compute_class` in the request wins; without it your account's default class is used ( Settings → Compute Preferences ), and without a default `economy`. The SDKs and MCP send nothing when you don't set it – the server decides. 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")
Sandbox.create(template="base", compute_class="memory")
run_job(command="make -j4", compute_class="performance", optimize_for="price", timeout_seconds=600,
        max_cost="0.10")                          # for CZK use "2.50"
```

**TypeScript**

```
import { WBX } from "wbxsandbox";

const wbx = new WBX();
console.log(await wbx.compute.preferences());      // classes, prices, your default
await wbx.compute.setDefaultClass("balanced");
await wbx.sandboxes.create({ template: "base", computeClass: "memory" });
await wbx.jobs.create({ command: "make -j4", computeClass: "performance", optimizeFor: "price", timeoutSeconds: 600,
                        maxCost: "0.10" });   // for CZK use "2.50"
```

**curl**

```
curl -s https://sandbox.wbx.cz/v1/compute/preferences -H "Authorization: Bearer $WBXSANDBOX_API_KEY"

curl -s -X PUT https://sandbox.wbx.cz/v1/compute/preferences -H "Authorization: Bearer $WBXSANDBOX_API_KEY" \
  -H "Content-Type: application/json" -d '{"default_compute_class": "balanced"}'

curl -s -X POST https://sandbox.wbx.cz/v1/jobs -H "Authorization: Bearer $WBXSANDBOX_API_KEY" -H "Content-Type: application/json" \
  -d '{"command": "make -j4", "compute_class": "performance", "optimize_for": "price", "timeout_s": 600, "max_cost": "0.10"}'   # for CZK use "2.50"
```

From an AI assistant: ask it to use a class – the MCP tools `create_sandbox` and `run_job` take `compute_class`, and `get_compute_classes` lists what you can use.

## Price

Each class has its own price relative to your plan's rates (shown in Compute Preferences and on the [pricing page](https://sandbox.wbx.cz/pricing)). The price of a sandbox or job is fixed when it is created or accepted – later changes of the price list or of your default do not change running sandboxes or accepted jobs. The worst-case cost of a job (`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. `placement` (`auto` – default, `fast`, `spread`) is an older way to choose the server; when both are sent, `optimize_for` wins. 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`).

## Errors

An unknown class answers `400 invalid_compute_class`, a class your plan does not include `403 class_not_allowed`, a class that is temporarily unavailable `409 class_disabled`. All codes: [Errors](https://sandbox.wbx.cz/docs/errors.md#account).

## Next steps

- [Pricing](https://sandbox.wbx.cz/pricing): Rates of each plan and class.
- [Create and manage](https://sandbox.wbx.cz/docs/sandboxes.md): All options of a new sandbox.
- [Background jobs](https://sandbox.wbx.cz/docs/jobs.md): Long work with a price limit.

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