# VAIATA Inference GPU API v1

Base URL `https://api.vaiata-inference.com`; every API route is under `/v1`. JSON in/out. Auth `Authorization: Bearer <api_key>` on every `/v1` request (one or more keys per customer, revocable). This page: `GET /docs` (also `/llms.txt`); machine-readable `GET /openapi.json` (OpenAPI 3.1, schemas + examples). Errors: `{"error":"<code>","message":"what is wrong","hint":"next step (when there is one)"}`. Request bodies: at most 64 KiB (also MCP); larger → `413 {"error":"too_large"}`.

## Model

A booking = N GPUs on one server, held now, until `end_at` or an earlier `DELETE`. Hardware: NVIDIA RTX PRO 6000 Blackwell 96 GB, Marseille FR. Sizes 2, 4 or 8 GPUs. The container is destroyed at the end and its disk deleted.

Also NVIDIA DGX Spark (GB10), `gpus: 1` (section below).

Prices (excl. VAT) follow the market price of our machines, refreshed every 10 min; current values in `/prices.json` (examples below are illustrative); locked per booking (`price_per_gpu_hour` in the booking). Flex: a request with `max_wait_minutes` >= 360 that is held from the queue pays up to 10% less, locked at hold, actual `discount` percent in the booking; a request held immediately pays full price.

Billing per GPU-minute from hold (`held_at`) to end (`ended_at`, at the latest when we accepted your `DELETE`), started minute counted, capped at `end_at`. Model download/load time is billed. A booking that never reaches `held` is not billed.

Terms (CGV): `GET /legal/terms`; privacy policy: `GET /legal/privacy` (plain text, header `X-Legal-Version: 2026-11`); the DPA is available to customers at `/legal/dpa` with your key. Automated abuse detection (outgoing mail, mining, network scanning) may end a booking and suspend the account.

EU customers: French company; invoices in EUR or USD, VAT reverse charge for EU businesses; DPA on request.

## Try a DGX Spark before buying one

One NVIDIA DGX Spark: GB10 Grace Blackwell, 128 GB unified memory, arm64, 1 GPU (`gpus: 1`), price in `/prices.json`. `image` built for arm64 or multi-arch (e.g. `nvcr.io/nvidia/pytorch:25.09-py3`), or preset `vllm` (same endpoint and token as on RTX, 128 GB unified memory for the model); preset `base` is RTX only. Root SSH as for RTX bookings. If a Spark runs out of memory it freezes and reboots by itself (~90 s); running processes are lost, the booking continues.

## Endpoints

Reuse one HTTPS connection (keep-alive / HTTP/2) for many calls: about 0.1 s per call from a datacenter, the first call costs the TLS setup.

`GET /prices.json` (no auth, CORS `*`, cached 60 s): public price list + live availability.
```
{"updated_at":"2026-11-01T12:00:00Z","status":"ok","currency":"USD","billing":"per minute","docs":"https://api.vaiata-inference.com/docs",
 "offers":[{"gpu_type":"rtx-pro-6000-96gb","name":"RTX PRO 6000 96 GB","arch":"amd64","memory_gb":96,"location":"Marseille, FR","price_per_gpu_hour":"1.44","flex_price_per_gpu_hour":"1.39","sizes":[2,4],
            "next_free":{"8":{"at":"2026-11-01T15:20:00Z","p80_at":"2026-11-01T19:00:00Z","basis":"estimate","sample":42}},"next_free_note":"estimate from past rental durations; not a reservation"},
           {"gpu_type":"gb10-128gb","name":"DGX Spark GB10 128 GB","arch":"arm64","memory_gb":128,"location":"Marseille, FR","price_per_gpu_hour":"0.40","flex_price_per_gpu_hour":"0.36","sizes":[]}]}
```
`sizes` = GPU counts bookable now; `[]` = none free now (queue with `max_wait_minutes`). `next_free` (sizes not free now): when that size should free up, an estimate, not a promise or reservation: `at` median, `p80_at` 80% likely by then (null = unknown), `basis` `exact` (only our own bookings' end times) or `estimate` (past rental durations of comparable contracts, `sample` = how many), `null` = no estimate; recomputed every 5 min, absent when `status` is `degraded`. `status`: `ok`, or `degraded` = bookings temporarily paused on our side (sizes `[]`, not a capacity shortage).

Temporary outage on our side (capacity monitoring or provider unreachable): `GET /v1/availability`, `POST /v1/bookings` (also `dry_run`), `PATCH /v1/bookings/{id}` and the MCP tools `get_availability`/`book_gpus`/`extend_booking` answer `503 {"error":"engine_unavailable","message","hint"}`: retry in a few minutes; queued requests keep their place, running bookings are unaffected.

`GET /health` (no auth) → `{"ok","engine_online","paused_feed_age_s"}`; 503 + `engine_online:false` when bookings are temporarily impossible (capacity monitoring feed older than 3 min).

`GET /v1/availability`
```
{"gpu_type":"rtx-pro-6000-96gb","location":"marseille-fr","sizes":[2,4],"price_per_gpu_hour":"1.44","currency":"USD",
 "offers":[{"gpu_type":"rtx-pro-6000-96gb","arch":"amd64","sizes":[2,4],"price_per_gpu_hour":"1.44"},
           {"gpu_type":"gb10-128gb","arch":"arm64","sizes":[1],"price_per_gpu_hour":"0.40","image":"arm64 or multi-arch image, or preset vllm"}]}
```
`sizes` = sizes bookable right now (a size free but promised to earlier queued requests is not listed). Each offer also carries `next_free` / `next_free_note` as in `/prices.json` (estimate, not a reservation). Empty list = no capacity now (queue with `max_wait_minutes`, below). Top-level fields = RTX (unchanged); `offers` lists every GPU type.

`POST /v1/watches {"gpus":8,"gpu_type":"rtx-pro-6000-96gb","webhook_url":"https://..."}` notify me when free: one webhook `capacity.available` as soon as that size is bookable, then the watch is `fired` (nothing is held: book with `POST /v1/bookings`, first come first served). `gpu_type` optional (implied by `gpus`); `webhook_url` optional, default your account's webhook, https and public host only, signed with your webhook secret (an account without webhook → `400 no_webhook`; email notification not available). Expires after 7 days (`expired`); at most 5 active per customer (`429 too_many_watches`). `201 {"id":"wt_...","gpu_type","gpus","webhook_url","status":"active","created_at","expires_at","fired_at":null}`. `GET /v1/watches` lists yours (newest first, `active|fired|expired|cancelled`); `DELETE /v1/watches/{id}` cancels an active one.

Tested `vllm` config, measured on 1 RTX PRO 6000 (vLLM 0.32; a booking runs `--tensor-parallel-size` = `gpus`): model `nvidia/Qwen3.6-35B-A3B-NVFP4`, `vllm_args`: `--max-model-len 32768 --kv-cache-dtype fp8 --reasoning-parser qwen3 --gpu-memory-utilization 0.92 --max-num-seqs 1024 --speculative-config {"method":"mtp","num_speculative_tokens":1}` → about 7,000 output tokens/s at 256 concurrent requests. Keep `--gpu-memory-utilization` at 0.92 or below.

`GET /v1/images` → presets: `base` (CUDA, SSH), `vllm` (OpenAI-compatible HTTPS endpoint for a Hugging Face model), or any public Docker image (`image`).

`POST /v1/bookings` — required `gpus`, `hours`, `ssh_public_key`; then one of `preset: "base"` (default), `preset: "vllm"` + `model`, or `image`. Minimal: `{"gpus":2,"hours":1,"ssh_public_key":"ssh-ed25519 ..."}`. Full:
```
{"gpus":4, "hours":6, "ssh_public_key":"ssh-ed25519 ...",
 "preset":"vllm", "model":"Qwen/Qwen3-...", "vllm_args":"--max-model-len 32768", "hf_token":"hf_...",
 "image":null, "disk_gb":200, "reference":"your-id-123", "max_wait_minutes":null, "auto_end_idle_minutes":null}
```
`auto_end_idle_minutes` (15..1440, default null = off): end the booking automatically after that many consecutive minutes idle (below).
Header `Idempotency-Key` recommended: a retried request with the same body returns the same booking; the same key with a different body → `422 idempotency_mismatch`.
- `201` booking with `status:"held"` (GPUs are yours and billing starts); `GET /v1/bookings/{id}?wait=ready` until `ready` for `ssh`, `api_url`, `api_token`.
- `202` `status:"requested"` if the hold takes longer than ~50 s; poll `GET /v1/bookings/{id}`.
- `409 {"error":"no_capacity","sizes":[2],"hint":...}` (hint includes the flex price) nothing held, nothing billed; header `Retry-After: 30`. To wait instead of retrying, resend with `max_wait_minutes` (next line).
- `202` `status:"waiting"` with `max_wait_minutes` (1..1440) set and the size not free: the request is queued instead of refused, nothing billed. We hold it as soon as the size frees up (queued requests served earliest first, within your quota and monthly spend limit); a request can be queued while your quota is in use (held once it fits); `hours` count from the hold. `wait_until` = deadline; past it, or after 5 refused hold attempts, the booking becomes `expired` (`end_reason:"max_wait"`); also `expired` with `end_reason:"spend_limit"` if your spend limit was lowered below the committed spend while it waited. `hf_token` is kept in memory only, never stored: if our service restarts while the request waits, the hold fails with a message asking you to book again. `DELETE` while waiting → `cancelled`. `max_wait_minutes` >= 360 = flex price (up to 10% off) once held from the queue.
- `400` invalid input: missing fields (`"message":"missing required fields: ..."`), unknown fields (`"unknown fields: ..."`), bad values; `401` bad key; `402 spend_limit` monthly spend limit reached (below); `429` customer GPU quota reached, or `429 queue_full` (at most 4 waiting requests per customer); `403 suspended` account suspended after abuse detection; `502` hold refused by the provider; `503 engine_unavailable` retry later.

Do not create a booking to test the API: a `201` holds and bills real GPUs. Validation happens before any hold, so an invalid request (`400`) costs nothing; `GET /v1/availability` is the capacity check. To check a request end to end without booking, add `"dry_run": true`: `200 {"valid":true,"available_now","sizes","price_per_gpu_hour","discount","max_cost","within_limit"}` (flex price when `max_wait_minutes` >= 360 and not available now; `within_limit:false` = the real request would get `402 spend_limit`, with `spend_limit` and `hint`), nothing held or billed.

`GET /v1/bookings/{id}`
```
{"id":"bk_...","status":"ready","gpus":4,"reference":"your-id-123",
 "held_at":"2026-11-02T10:00:12Z","end_at":"2026-11-02T16:00:12Z","ended_at":null,
 "ssh":"ssh -p 41022 root@1.2.3.4","ssh_host_key":"ssh-ed25519 ...",
 "api_url":"https://1.2.3.4:41080/v1","api_token":"...",
 "disk_gb":200,"price_per_gpu_hour":"1.44","discount":0,"billed_minutes":37,"cost":"3.55"}
```
`api_url` (preset `vllm`) is `https://bk-<id>.vaiata-inference.com/v1` with a publicly trusted certificate on hosts behind our tunnel (paths under `/v1/` only; a non-streamed response must start within 125 s, so use `stream: true` for long generations; request body max 100 MB). Elsewhere, and always as `api_url_direct`, it is the host IP and port with a self-signed certificate: skip certificate verification for that URL only (`curl -k`, `httpx`/OpenAI client `verify=False`; `api_token` authenticates), or reach it through an SSH tunnel (`ssh_host_key` pins the host). Internal: src/tunnel.rs, env TUNNELS=machine=tunnel_uuid[@lo-hi],.. (allowed host ports, default 30000-30998) CF_TOKEN_FILE CF_ACCOUNT_ID CF_ZONE_ID; each sync makes the tunnels' ingress and the bk-<16 hex> CNAMEs (only those, only to our tunnels) match held/ready vllm bookings; port from the engine's direct URL (instance ports), 30000-30998 only.
`auto_end_idle_minutes` (null = off) and `idle_minutes` (current consecutive idle minutes); `end_reason` (`ended`, `window_end`, `idle`, `credit`, ...) once ended.

Blocking wait instead of polling: `GET /v1/bookings/{id}?wait=ready&timeout=S` (S seconds, default 300, max 600) answers as soon as the status is `ready` or final (`failed`, `expired`, `ended`, `cancelled`), else with the current state when S runs out; always `200` with `"waited":true`, `"timed_out":true|false`, `"wait_timeout_s"`. Through `https://api.vaiata-inference.com` (Cloudflare cuts requests at 100 s) the wait is capped at 90 s: loop while `timed_out` is true. `429 too_many_waiters` (header `Retry-After: 5`) when too many waits run at once: retry, or poll without `wait`.

Status: `held` (container starting / model loading) → `ready` (SSH up; for `vllm`, `/v1/models` answers) → `ended`. `failed` = never held. `cancelled` = DELETE while waiting or before the hold. Queued requests: `waiting` → `held`, or `expired` (no capacity before `wait_until`), or `cancelled`; `failed`, `expired` and `cancelled` are not billed. Typical `held`→`ready`: under 1 min with a cached image, plus model load.

`GET /v1/bookings?status=active|ended&from=&to=` list, newest first (`active` includes `waiting`; `ended` includes `failed`, `expired`, `cancelled`; `from`/`to` = creation date, YYYY-MM-DD; other values → `400`).

`PATCH /v1/bookings/{id} {"end_at":"2026-11-02T20:00:00Z"}` extend or shorten the window: `end_at` is the new absolute end (UTC `YYYY-MM-DDTHH:MM:SSZ`, at least 2 min ahead, at most 72 h after `held_at`); to extend by N hours send the current `end_at` + N h. Only `end_at` and `auto_end_idle_minutes` (15..1440 or null, applied at once, also while waiting) can be sent. An extension above the monthly spend limit → `402 spend_limit`, nothing changed. `end_at` changes only on `200` (`202` = still being applied: poll `GET /v1/bookings/{id}`); `409 conflict` booking no longer extendable or an earlier change still being applied (retry once its `end_at` shows), `502 engine_error` not applied, retry.

`DELETE /v1/bookings/{id}` end now; returns the final booking (`ended_at`, `billed_minutes`, `cost`), or `202` `status:"ending"` if destruction takes longer than 60 s. `502 {"error":"engine_error","message":...,"booking":{...,"status":"ending"}}`: destruction failed, we retry automatically; billing stops when the container is destroyed.

`GET /v1/usage?from=2026-11-01&to=2026-12-01` (both required, YYYY-MM-DD; a calendar month = its first day to the next month's first day) → `{"lines":[...],"total":"12.34","currency":"USD"}`, billed lines + total, the basis of the monthly invoice. Each line bills only the minutes inside `[from, to)`; a booking crossing the boundary appears in both periods. `"partial": true` = booking still running, its line can still grow. Line costs of one booking over consecutive periods add up exactly to its `cost` (each line = rounded cost up to `to` minus rounded cost up to `from`).

Idle auto-end (opt-in, `auto_end_idle_minutes`): we sample each `ready` booking about once a minute: GPU utilisation of every GPU and the container's network counters. The time between two samples is idle when all GPUs are at 0% and received + sent traffic grew by less than 1 MB per minute; any activity resets the count. A monitoring gap (no sample for over 3 min, or no network counters) neither counts nor resets; nothing counts while `held` (model loading). After `auto_end_idle_minutes` minutes of idle time in a row the booking is ended like `DELETE` (`end_reason:"idle"`, webhook `booking.ended`); billing stops, the disk is deleted. A background job that only uses the CPU looks idle: leave it off for that.

`GET /v1/account` → `{"customer","quota_gpus","active_gpus","month","monthly_spend_limit_usd","monthly_spend_cap_usd","spent_this_month_usd","committed_usd","available_usd","currency"}`. Monthly spend limit (USD, calendar month UTC): committed = this month's usage + the maximum remaining cost of active and queued bookings (to their `end_at`, or `hours` for queued ones). `POST /v1/bookings` (also queued requests) and an extending `PATCH` that would push committed above the limit are refused: `402 {"error":"spend_limit","message","hint","limit","committed","requested","currency"}`, nothing booked. New accounts get a cap of 100 USD per month (ask us to raise it). Concurrent requests cannot overshoot: an extension counts from the moment it is accepted. `PATCH /v1/account {"monthly_spend_limit_usd": 200}` sets your own limit (`null` removes it); `monthly_spend_cap_usd` is a cap set by us, your limit cannot exceed it, effective limit = the lower of both (`null` = none).

Sign up (self-serve, professionals only, CGV 1.2): `POST /signup` (no key; CORS `*`; 5 per address, then 1 per 10 min) `{"email","legal_name","address":{"line1","line2","city","postal_code","country"},"siren","vat_id","reg_no","accept_terms":"2026-11"}`: France (and Monaco) `siren` (9 digits), other EU countries `vat_id` (checked on VIES), outside the EU `reg_no` (company registration number). → `{"account","checkout_url","tax_treatment"}`: open `checkout_url` to verify a card (not charged); the API key is then emailed to `email`. Refused, nothing created: plus-addressing, alias or disposable addresses, domains without MX (`400 email_refused`), VAT number invalid on VIES (`400 vat_invalid`), territories outside the EU VAT area and sanctioned countries (`400 country_refused`), an email that already has an account (`409 exists`); VIES unreachable → `503 vies_unavailable` (retry later). A new self-serve account: 2 GPUs at a time and 100 USD per month until its first top-up; trial credit 5 USD for 30 days, DGX Spark (`gpus: 1`) only, once per company and per card (not with prepaid cards).

Prepaid credit (self-serve accounts): `POST /v1/topup {"amount_usd": 50}` (50 to 10000 USD) charges the verified card and issues one invoice per top-up (emailed by Stripe) → `{"invoice","status":"paid","amount_usd","tax_usd","total_usd","invoice_pdf","hosted_invoice_url","credit_usd"}`; card refused → `402 payment_failed`, nothing charged. VAT added for France (20 %), reverse charge for EU businesses, none outside the EU. Credit is valid 12 months from purchase, oldest top-up used first. After the first top-up: 8 GPUs, no monthly cap (your own limit still applies). Bookings (also queued ones and extensions) must fit the credit: maximum remaining cost of active and queued bookings + requested <= credit (trial credit: Spark only), else `402 {"error":"insufficient_credit","message","hint","limit","committed","requested","currency"}` (`dry_run`: `within_limit:false`). When the credit reaches zero running bookings end (`end_reason:"credit"`); a queued request that no longer fits expires (`end_reason:"credit"`). `GET /v1/account` adds `credit_usd` (top-ups left), `trial_usd`, `credit_expiring` `{"at","usd"}` (next expiry, null = none).

Rate limits: 20 requests/s per API key (bursts of 60; a blocking wait or an MCP call counts once), 10 requests/s per client IP without a key (bursts of 30), 20 failed authentications per IP per 10 min (only requests with an unknown key are refused then; valid keys from the same address are not). Over the limit: `429 {"error":"rate_limited","retry_after_s":N}` with header `Retry-After: N`.

Suspended account (`403 {"error":"suspended"}`): after automated abuse detection (outgoing mail on port 25, mining, repeated network scanning) the booking is ended (`end_reason:"abuse"`) and the key can only read its bookings and usage, and end them. Mail or mining: one sample (about a minute) is enough. Scanning: 3 samples within 10 min on one booking block new bookings (lifted automatically after 30 min without a scan sample); 3 more within 10 min of that block end the booking and suspend fully. Contact us to review a full suspension.

Webhooks (optional, one HTTPS URL per customer, set by us; the signing secret is given once): `POST` JSON `{"event":"booking.held|booking.ready|booking.ended|booking.failed|booking.expired","booking":{...same as GET /v1/bookings/{id}...}}`; watches: `{"event":"capacity.available","watch":{...},"gpus":8,"offer":{"gpu_type","arch","location","sizes","price_per_gpu_hour","flex_price_per_gpu_hour","currency"}}` (to the watch's `webhook_url`). Public addresses only, redirects not followed, 10 s timeout. Answer 2xx; otherwise retried after 10 s, 60 s and 300 s, then dropped. Pending deliveries and retries survive our restarts. Events may repeat or arrive out of order: `GET /v1/bookings/{id}` is authoritative. Headers `X-Webhook-Timestamp: <unix seconds>` (set at each delivery attempt) and `X-Signature: sha256=<hex HMAC-SHA256(secret, timestamp + "." + raw body)>`. Verify on the raw bytes and reject a timestamp more than 5 min from your clock (replay protection):
```
import hmac, hashlib, time
ts = request.headers["X-Webhook-Timestamp"]
ok = abs(time.time() - int(ts)) <= 300 and hmac.compare_digest(request.headers["X-Signature"],
     "sha256=" + hmac.new(secret.encode(), ts.encode() + b"." + raw_body, hashlib.sha256).hexdigest())
```

## Use from an AI agent (MCP)

MCP server (Model Context Protocol, Streamable HTTP, stateless) at `POST https://api.vaiata-inference.com/mcp`, same API key in `Authorization: Bearer <api_key>`. Protocol `2026-07-28` (`server/discover`, per-request `_meta`) and `2025-11-25` / `2025-06-18` / `2025-03-26` (`initialize`). Tools: `get_availability`, `book_gpus` (body of `POST /v1/bookings` + `dry_run`, `idempotency_key`, `wait_ready` seconds), `get_booking` (`wait_ready`), `extend_booking` (`add_hours` or `end_at`, `auto_end_idle_minutes`), `end_booking`, `list_bookings`, `get_usage` (default this month), `get_account`, `set_spend_limit`, `watch_capacity` (body of `POST /v1/watches`). API errors come back as tool results with `isError: true`, the error code, message and hint. Discovery: server card `GET /mcp/server-card` (also `/.well-known/mcp.json`), AI catalog `GET /.well-known/ai-catalog.json`.

Claude Code:
```
claude mcp add --transport http vaiata https://api.vaiata-inference.com/mcp --header "Authorization: Bearer vk_..."
```
Other clients (Cursor, VS Code, Claude Desktop via JSON config):
```
{"mcpServers":{"vaiata":{"type":"http","url":"https://api.vaiata-inference.com/mcp","headers":{"Authorization":"Bearer vk_..."}}}}
```
Booking costs money: set a monthly spend limit (`set_spend_limit`) before giving an agent the key, and let it `dry_run` first.
