
# Dry Run API: Get the Exact Price Without Creating Anything

**The 0x.cloud dry run API is a `dry_run` flag on the create-server request: the service calculates the exact price and returns it, but creates no server and charges nothing.** You, or your AI agent, can check the cost of a plan, billing period, and add-ons before buying. It works in the REST API and through the MCP server in Claude, Cursor, or ChatGPT.


## What a dry run API does

A dry run executes a request "on paper." The server validates the input and answers as if it ran the action, but changes nothing. You have probably seen the pattern before: `kubectl apply --dry-run=server`, `terraform plan`, or the `DryRun` parameter in the AWS EC2 API.

Those tools answer different questions. AWS `DryRun` tells you whether you have permission to run an action. Kubernetes shows the object that would be stored. On 0x.cloud, the question is money: what will this exact server cost? That matters with hourly billing, and it matters even more when an AI agent, not a person, places the order. The agent gets the exact number first, shows it to you, and creates the server only after you approve.

## How dry_run works on 0x.cloud

Send a normal create-server request, `POST /v1/servers`, and add `"dry_run": true` to the body. The service:

1. validates the parameters (plan, billing period, image, extra disk);
2. calculates the exact price for those parameters;
3. returns it together with the server resources and a quote, `pricing_fingerprint`;
4. creates nothing and charges nothing to your balance.

The quote is valid for 10 minutes. To create the server for real, send the same request without `dry_run` but with that `pricing_fingerprint`; this guarantees you are charged exactly the amount you saw. A real create request without a quote is rejected.

## API dry run example with curl

You need an API key from your dashboard (the API and MCP section) with the `servers.create` scope: dry_run checks the same scope as creating a server. See [API key permissions](https://0x.cloud/kb/api-mcp/api-keys) for how to create one and which scopes to grant. Store the key in an environment variable so it never ends up in your shell history or code:

```bash
# Linux and macOS: the key lives only in this terminal session
export OX_API_KEY="0x_live_your_key"
```

```powershell
# Windows PowerShell
$env:OX_API_KEY = "0x_live_your_key"
```

Ask for the price of an s1-2 server for one month:

```bash
# A create-server POST with dry_run: returns the price, creates nothing
curl -s https://0x.cloud/v1/servers \
  -H "Authorization: Bearer $OX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"plan": "s1-2", "billing_cycle": "monthly", "dry_run": true}'
```

Sample response (trimmed):

```json
{
  "dry_run": true,
  "plan": "s1-2",
  "billing_cycle": "monthly",
  "monthly_usd": "7.99",
  "hourly_usd": "0.054725",
  "total_usd": "7.99",
  "resources": {"vcpu": 1, "ram_mb": 2048, "disk_gb": 30},
  "pricing_fingerprint": "…long opaque string…",
  "pricing_expires_at": "2026-11-20T12:10:00Z",
  "within_key_limit": true,
  "balance_enough": true
}
```

How to read it:

- `total_usd` is what will be charged on creation; `monthly_usd` is the plan's monthly price, `hourly_usd` the exact hourly rate (six decimals);
- `resources` shows exactly what you are buying: cores, memory and disk;
- `within_key_limit` and `balance_enough` tell you upfront whether the key's spend cap and your balance cover it;
- `pricing_fingerprint` and `pricing_expires_at` are the quote and its expiry (10 minutes).

Change the period with `billing_cycle`: `hourly`, `monthly`, `quarterly` (3 months, 5% off), `semiannual` (6 months, 9% off), `annual` (12 months, 12% off). For s1-2, `annual` totals $84.37 instead of 12 × $7.99 = $95.88. For a public price list with no key at all, use `GET https://0x.cloud/v1/public/pricing`.

## Creating the server after a dry run

Once the price is approved, repeat the request without `dry_run` and with the quote. The `Idempotency-Key` header prevents a duplicate server if the connection drops:

```bash
curl -s https://0x.cloud/v1/servers \
  -H "Authorization: Bearer $OX_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"plan": "s1-2", "billing_cycle": "monthly", "pricing_fingerprint": "…from the dry_run response…"}'
```

`plan`, `billing_cycle` and `extra_disk_gb` must match the dry run. If the quote expired or the price changed, you get 409 `price_changed` with a fresh quote in `error.quote`: no server, no charge. Show the new price and confirm again. A successful 201 response returns the server and the root password, which is shown only once. The full list of fields is in the [REST API quickstart](https://0x.cloud/kb/api-mcp/api-quickstart), and all plans are on the [VPS pricing](https://0x.cloud/pricing) page.

## Dry run from chat via MCP

If you connected the [0x.cloud MCP server](https://0x.cloud/mcp) to Claude, Cursor, or ChatGPT, you don't need curl at all. Ask the assistant:


```text
Using the 0x.cloud MCP server, get the exact price of an s2-4 server with Ubuntu 24.04 for 1 month and for hourly billing. Use dry_run and don't create anything. Show both prices in a table.
```


The assistant calls the `create_server` tool with `dry_run`, gets the price, and shows it. If you then say "create it," it repeats the call without the flag and with the returned `pricing_fingerprint`.

## Why dry run matters for AI agents

Agents make mistakes fast. They might pick a bigger plan than you need or choose a yearly period instead of hourly. A "dry_run first, human approval second" rule turns that mistake into a line in the chat instead of a charge. Two more guardrails work alongside it:

- **key scopes**: `servers.read`, `servers.create` and `servers.delete` are granted separately;
- **a monthly spend cap** on each key: a paid request past it gets 402 `key_spend_limit_reached`, and `within_key_limit` in the dry run response warns you in advance. Hourly servers the key already created keep billing and count toward the cap.

All three are covered in [how to limit an AI agent](https://0x.cloud/kb/ai/limit-ai-agent). Put the rule straight into your agent's instructions, for example in the project's `CLAUDE.md` or `AGENTS.md`:


```text
Before creating any server on 0x.cloud, always send a dry_run request first, show me the monthly and hourly price, and wait for my explicit "yes". Never create anything without confirmation.
```


## Common errors and fixes

| What you see | Cause | Fix |
|---|---|---|
| 401 `unauthenticated` | missing or wrong key | check the `Authorization: Bearer ...` header and that `OX_API_KEY` is set in this session |
| 403 `insufficient_scope` | the key lacks `servers.create` | grant it in the dashboard or use another key |
| 404 `plan_not_found` | typo in the plan code | use s1-1, s1-2, s2-4, or s4-8 |
| 422 `validation_failed` | bad field, e.g. `billing_cycle: "yearly"` | `error.message` lists the fields; valid periods are hourly, monthly, quarterly, semiannual, annual |
| 409 `price_changed` on create | quote older than 10 minutes or parameters differ | get a fresh dry run price and approve it |
| JSON parse error in PowerShell | quotes are escaped differently | call `curl.exe` and send the body from a file: `-d "@body.json"` |

API errors come back as JSON with a code and a message, so an agent can read the reason and fix the request on its own.


[Create server: s1-2, $7.99/mo](https://0x.cloud/cabinet/create?plan=s1-2)


## Dry run API FAQ

**What does dry run mean in an API?**
A dry run validates a request and shows what would happen without actually doing it. On 0x.cloud, dry_run on a create-server request returns the exact price and creates nothing.

**Am I charged for a dry_run request?**
No. A dry_run request creates nothing and charges nothing. You can send it as many times as you like.

**Is dry_run the same as AWS DryRun?**
The idea is similar, the purpose differs. AWS DryRun mainly checks whether you have permission for an action. The 0x.cloud dry_run returns the exact price of the server you are about to create.

**Can I get a price from Claude or Cursor without writing code?**
Yes. Connect the 0x.cloud MCP server and ask the assistant for a dry_run price. It calls the tool and shows the amount without creating anything.

**Will the dry_run price match what I actually pay?**
Yes, if you create the server within 10 minutes with the same pricing_fingerprint and parameters. If the price changed, the API returns 409 price_changed and charges nothing.
