Skip to content

Spec · cloudsitus.yaml

One file. A plan you can read, then apply.

Declare the region, a database, buckets, models, GPU and a budget. Plan says what would be created, kept, changed or refused — each with a residency receipt and a monthly estimate at your prices. Apply runs exactly that plan, identified by its hash, or nothing.

https://cloudsitus.com/api/v1Plan a spec
version: 1
project: acme-notes
region: CH                  # every resource below runs here, or the plan refuses
data_class: general         # general | regulated
database:
  name: main
  auth: false               # true = hosted sign-in (/auth/v1), or {jwks_url, issuer, audience}
  realtime: false
storage:
  - bucket: uploads
    max_file: 50MB
models:
  chat: think               # a class (flash | think | pro) or a pinned model id
  embed: qwen3-embedding-8b
budget:
  monthly_usd: 200

On this page

Overview

How it works

The spec is applied through the same operations as the Databases API, key minting and the router — nothing is created by a side door. Over MCP the same flow is the deploy module (spec_example, spec_validate, spec_plan, spec_apply).
Resident or refusedrule

Every resource runs in the spec's region, or the plan refuses it. Nothing is moved to make a plan succeed. A model class whose fail-over would leave the region is pinned to its current winner, and the plan says so.

plan_hashthe contract

A hash of the spec and every decision in the plan. Apply recomputes the plan and refuses with 409 plan_changed if anything moved — a price, a route, your account — so you never apply something you did not read.

Idempotentby name

Resources are matched by name (a database by its label), so applying the same spec twice changes nothing the second time (status: "no_changes").

Schema

The file

YAML (a strict subset) or JSON, up to 64,000 characters. Unknown keys are errors, and every error names its path.
cloudsitus.yaml
version: 1
project: acme-notes
region: CH                  # every resource below runs here, or the plan refuses
data_class: general         # general | regulated
database:
  name: main
  auth: false               # true = hosted sign-in (/auth/v1), or {jwks_url, issuer, audience}
  realtime: false
storage:
  - bucket: uploads
    max_file: 50MB
models:
  chat: think               # a class (flash | think | pro) or a pinned model id
  embed: qwen3-embedding-8b
budget:
  monthly_usd: 200

version1required

Always 1.

projectstringrequired

3–40 characters, lowercase letters, digits and -, starting with a letter. Also the label of the API key apply creates.

regionregion coderequired

Where every resource runs, e.g. EU, US, ASIA, CH. WORLD is refused: it is not a place. No default.

data_classgeneraloptional

general (default). Other classes are set up with us per account.

databasemappingoptional

name (required, 1–48 characters, matched to an existing database by label), auth (false, or a block mapping jwks_url + issuer + audience), realtime (boolean).

storagelist (≤ 20)optional

{bucket, max_file?, public?}. bucket: lowercase letters, digits, . _ -, unique. max_file: 50MB, 1.5 GB, 500kb or bytes, at most 50 MB. Needs database.

modelstask → modeloptional

Tasks chat, code, vision, summarize, embed, rerank, stt, tts, ocr, image, video, decision. Value: a class (flash, think, pro, auto) or a model id. Adds an API key to the plan.

gpumappingoptional

placement (auto default, runpod, aws) and workload (container_job default, endpoint, pod). Only for accounts with GPU compute; otherwise the plan refuses it, which is why the example has no gpu block. Apply creates nothing for GPU; it records the binding. See GPU.

budget.monthly_usdnumberoptional

Above 0 and up to 1,000,000. Fixed monthly charges above it block the plan (over_budget) unless you pass allow_over_budget. Usage-based charges are listed, not counted.

The YAML subset

Block mappings and lists, quoted or plain scalars, numbers, booleans, null, # comments and flow lists of scalars. Refused, with the line: tabs, anchors and aliases, tags, block scalars (| >), flow mappings ({…}), several documents and duplicate keys. A spec must declare at least one of database, storage, models, gpu.

Endpoint

Plan

POST/v1/spec/plan
Changes nothing and needs no credit. Send the YAML as the body (Content-Type: application/yaml, text/yaml or text/plain, options in the query string), or JSON {"spec": "<yaml or json>" | {…}, …options}.
POST/v1/spec/plan
curl https://cloudsitus.com/api/v1/spec/plan \
  -H "Authorization: Bearer cs_live_…" \
  -H "Content-Type: application/yaml" \
  --data-binary @cloudsitus.yaml
statusready | no_changes | refused

refused if any resource is refused or a blocker applies.

resources[].actionaction

create (+), keep (=), change (~, a bucket's public / max_file or the auth issuer), replace (-/+, the database exists in another region: destructive), use (>, a model or GPU binding), refuse (!, with refusal.code).

resources[].receiptresidency

region, processed_in, resident, host, and per kind model + failover, cell, or the GPU segment and data_centers.

resources[].costestimate

monthly_fixed_usd and the usage rates at your prices.

textstring

The plan in a few readable lines, for a person or a pull-request comment.

Endpoint

Apply

POST/v1/spec/apply
The same body plus the plan_hash you read. Steps run in order and stop at the first failure; what already ran is kept.
plan_hash64 hexrequired

From the plan. 400 plan_hash_required without it.

allow_destructivetrueoptional

Required when the plan replaces a database (needs_allow_destructive). The new database is created first; the old one is then deleted with the usual 7-day restore window. Over MCP this flag is never read — a person approves instead.

allow_over_budgettrueoptional

Lifts the over_budget blocker.

include_service_keytrueoptional

Adds the database's service_role_key to outputs and env. REST only.

POST/v1/spec/apply
curl https://cloudsitus.com/api/v1/spec/apply \
  -H "Authorization: Bearer cs_live_…" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --rawfile spec cloudsitus.yaml --arg h "$PLAN_HASH" '{spec: $spec, plan_hash: $h}')"

Outputs

env is ready to paste into your environment file. A new API key appears only when apply created it (it is shown once). A step that fails returns 502 apply_incomplete with the same body, so you see what was done.

Reference

Refusals

A refused resource carries one of these codes; the plan's text says why.
region_not_availablerefusal

The product has no host or cell open in this region yet.

not_residentrefusal

The model (or its fail-over) would process outside the region.

unknown_model · model_not_available_in_region · no_routerefusal

As on the AI endpoints.

feature_not_availablerefusal

Declared but not available on your account or in this region yet (for example hosted sign-in or realtime through the spec).

plan_limit_reached · limit_exceededrefusal

Your plan's allowance, or a hard limit (e.g. a bucket's max_file).

ambiguous_name · depends_on_refused · subkey_not_allowed · state_unavailablerefusal

Two databases share the name; a resource depends on a refused one; a customer sub-key; account state could not be read (retry).

over_budgetblocker

The fixed monthly estimate is above budget.monthly_usd.

Reference

Errors

400invalid_spec

The file did not validate; errors: [{path, message}] (up to 50).

400invalid_request / invalid_json

No spec, or a body over the limit.

409plan_changed

The plan moved since you read it; the new plan is in the error. Read it, apply again with its hash.

422plan_refused

The plan has refusals or blockers; nothing ran.

403destructive_not_allowed

The plan replaces a database and allow_destructive was not sent.

403insufficient_key_scope / insufficient_scope

A dashboard-session key cannot apply a plan that mints a key, returns the service key or deletes; an OAuth token needs the scopes of what it changes (required_scopes).

402payment_required

A plan that creates or changes something needs credit; no_changes does not.