llms.txt

Staging quickstart for agents

How an agent reaches X9 today: a gated staging endpoint with simulator hosts and sandbox money. Nothing real can be rented or paid here; the routes and rules are the real ones.

Gated. Both names answer only requests that carry a Cloudflare Access service token. A request without the headers CF-Access-Client-Id and CF-Access-Client-Secret gets a redirect to a login page, not a JSON error.

What to know first

  • Endpoints. REST API: https://staging.x9si.com (same routes as /openapi.json). MCP: https://mcp.x9si.com/mcp (streamable HTTP). There is no public endpoint yet; staging is the only one an outside agent can reach.
  • Gate. Both names sit behind Cloudflare Access. Every request needs the two headers CF-Access-Client-Id and CF-Access-Client-Secret, except the access request route below. Without them the answer is HTTP 302, a redirect to the Cloudflare Access login page (HTML for people), not a JSON error. With wrong values the answer is 401. Neither reaches X9.
  • Getting access. No invite yet? Ask with POST /v1/access_requests (no X9 key and no Access headers; body: role, use_case, contact_email or contact_webhook, optional acts_for and country; Idempotency-Key). The answer has a status_url and a poll_token; poll with header X-Access-Request-Token: <poll_token> (never in the URL): pending, then approved with a single use invite code, shown once, (and the service token once an X9 operator has made one by hand), or declined with the reason. MCP tool: request_access. Contact: [email protected] (not active yet).
  • Invite. Sign up on staging needs the body field invite on POST /v1/accounts. Without it the answer is 403 SCOPE_DENIED.
  • What is real. Nothing. Staging has simulator hosts only: a job "runs" for 40 seconds and returns a small output bundle, with no container and no GPU. Money is sandbox only, at most 50 USD free per account in its life (more answers 402 BUDGET_EXCEEDED). Not there: the relay (no SSH or port access to boxes, so use jobs, not instances), card top ups, resold offers, real hosts.
  • Idempotency-Key. Required on every write that moves money or creates something: here the top up, the quote and the job (also POST /v1/instances, POST /v1/keys and resource actions). Not taken by POST /v1/accounts, never on GET. 8 to 128 characters. The same key with the same body returns the first answer; the same key with another body answers 409 IDEMPOTENCY_CONFLICT, so use a new key for each new quote or job.
  • X9 key. GET /health and GET /v1/offers need no X9 key (they still need the two Access headers). Everything else sends Authorization: Bearer x9k_....
  • MCP. Streamable HTTP, stateless (no session id), JSON answers. Send Accept: application/json, text/event-stream; without it a POST answers HTTP 406 with JSON-RPC error -32000 "Not Acceptable" (MCP SDK). Three headers: the two Access headers and Authorization: Bearer x9k_... (a capped sub key, never the owner key).
  • Limits. At most 100 requests per 10 seconds per IP at the Cloudflare edge, then HTTP 429 for 10 seconds.

The sequence

  1. Health GET /health. X9 key: no. Idempotency-Key: none. Answer: {"ok":true,"service":"x9-api",...,"sandbox":true}. Proves the two Access headers work.
  2. Sign up with the invite code POST /v1/accounts. X9 key: no. Idempotency-Key: none. Answer: 201 with account_id and api_key (x9k_..., shown once, store it). Without invite: 403 SCOPE_DENIED.
  3. Sandbox top up POST /v1/wallet/top_ups. X9 key: yes. Idempotency-Key: required. Answer: 201 with credited_usd and balance_usd. Free test money, at most 50 USD per account in its life.
  4. List offers GET /v1/offers. X9 key: no. Idempotency-Key: none. Answer: offers[], each with an offer_id (off_...). Staging lists simulator hosts only.
  5. Quote POST /v1/quotes. X9 key: yes. Idempotency-Key: required. Answer: 201 with quote_id (qte_...), a firm price for 120 seconds. Quoting charges nothing.
  6. Submit a job POST /v1/jobs. X9 key: yes. Idempotency-Key: required. Answer: 201 with resource_id (rnt_...), status booting and poll_after_s. The worst case of the quote is held.
  7. Poll GET /v1/resources/{id}. X9 key: yes. Idempotency-Key: none. Answer: status and poll_after_s. With wait_s=60 the call is held until the status changes or 60 seconds pass. Repeat until poll_after_s is null: the status then reads succeeded, failed or cancelled. Without wait_s, wait poll_after_s seconds between calls (15 while the job boots or runs). A simulator job runs for 40 seconds, so expect a few calls.
  8. Output GET /v1/resources/{id}/artifacts. X9 key: yes. Idempotency-Key: none. Answer: artifacts[] with download_url and sha256. The download link also needs the two Access headers.
  9. Receipt GET /v1/receipts/{id}. X9 key: yes. Idempotency-Key: none. Answer: total_usd, line_items (every billed second) and broken_intervals.
staging quickstart (bash)
# bash. Fill in the three values the X9 team gives you.
# 0. No invite yet? ask with POST https://staging.x9si.com/v1/access_requests (no Access headers, no X9 key), then poll its status_url with header X-Access-Request-Token: <poll_token>
export X9_CF_ID='PASTE_CLIENT_ID' X9_CF_SEC='PASTE_CLIENT_SECRET' X9_INVITE='PASTE_INVITE_CODE'
S=https://staging.x9si.com
CF=(-H "CF-Access-Client-Id: $X9_CF_ID" -H "CF-Access-Client-Secret: $X9_CF_SEC")

# 1. Health (GET /health; no X9 key; no Idempotency-Key)
curl -s "${CF[@]}" "$S/health"
#    answer: {"ok":true,"service":"x9-api",...,"sandbox":true}. Proves the two Access headers work.

# 2. Sign up with the invite code (POST /v1/accounts; no X9 key; no Idempotency-Key)
curl -s "${CF[@]}" -H 'Content-Type: application/json' \
  -X POST "$S/v1/accounts" -d "{\"kind\":\"renter\",\"country\":\"US\",\"invite\":\"$X9_INVITE\"}"
#    answer: 201 with account_id and api_key (x9k_..., shown once, store it). Without invite: 403 SCOPE_DENIED.
X9_API_KEY='PASTE_API_KEY'   # api_key from the sign up answer
K=(-H "Authorization: Bearer $X9_API_KEY")

# 3. Sandbox top up (POST /v1/wallet/top_ups; X9 key; Idempotency-Key required)
curl -s "${CF[@]}" "${K[@]}" -H 'Idempotency-Key: x9-topup-0001' -H 'Content-Type: application/json' \
  -X POST "$S/v1/wallet/top_ups" -d '{"amount_usd":"20","method":"sandbox"}'
#    answer: 201 with credited_usd and balance_usd. Free test money, at most 50 USD per account in its life.

# 4. List offers (GET /v1/offers; no X9 key; no Idempotency-Key)
curl -s "${CF[@]}" "$S/v1/offers?limit=5"
#    answer: offers[], each with an offer_id (off_...). Staging lists simulator hosts only.
OFFER='PASTE_OFFER_ID'   # an offer_id from the list

# 5. Quote (POST /v1/quotes; X9 key; Idempotency-Key required)
curl -s "${CF[@]}" "${K[@]}" -H 'Idempotency-Key: x9-quote-0001' -H 'Content-Type: application/json' \
  -X POST "$S/v1/quotes" -d "{\"offer_id\":\"$OFFER\",\"max_runtime_s\":600,\"image\":\"ubuntu:24.04\"}"
#    answer: 201 with quote_id (qte_...), a firm price for 120 seconds. Quoting charges nothing.
QUOTE='PASTE_QUOTE_ID'   # quote_id from the quote answer

# 6. Submit a job (POST /v1/jobs; X9 key; Idempotency-Key required)
curl -s "${CF[@]}" "${K[@]}" -H 'Idempotency-Key: x9-job-0001' -H 'Content-Type: application/json' \
  -X POST "$S/v1/jobs" -d "{\"quote_id\":\"$QUOTE\",\"command\":[\"true\"]}"
#    answer: 201 with resource_id (rnt_...), status booting and poll_after_s. The worst case of the quote is held.
JOB='PASTE_RESOURCE_ID'   # resource_id from the job answer

# 7. Poll (GET /v1/resources/{id}; X9 key; no Idempotency-Key)
curl -s "${CF[@]}" "${K[@]}" "$S/v1/resources/$JOB?wait_s=60"
#    answer: status and poll_after_s. With wait_s=60 the call is held until the status changes or 60 seconds pass. Repeat until poll_after_s is null: the status then reads succeeded, failed or cancelled. Without wait_s, wait poll_after_s seconds between calls (15 while the job boots or runs). A simulator job runs for 40 seconds, so expect a few calls.

# 8. Output (GET /v1/resources/{id}/artifacts; X9 key; no Idempotency-Key)
curl -s "${CF[@]}" "${K[@]}" "$S/v1/resources/$JOB/artifacts"
#    answer: artifacts[] with download_url and sha256. The download link also needs the two Access headers.

# 9. Receipt (GET /v1/receipts/{id}; X9 key; no Idempotency-Key)
curl -s "${CF[@]}" "${K[@]}" "$S/v1/receipts/$JOB"
#    answer: total_usd, line_items (every billed second) and broken_intervals.

# MCP on https://mcp.x9si.com/mcp: streamable HTTP, stateless, needs Accept: application/json, text/event-stream
# K holds the owner key here; give a long running agent a capped sub key from POST /v1/keys instead
# MCP initialize
curl -s "${CF[@]}" "${K[@]}" -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
  -X POST "https://mcp.x9si.com/mcp" -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"my-agent","version":"1"}}}'
# MCP tools/list
curl -s "${CF[@]}" "${K[@]}" -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
  -X POST "https://mcp.x9si.com/mcp" -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'

Every route, body field, key rule and Idempotency-Key rule above is checked against /openapi.json when this site is built; the sequence is the one the X9 outside in staging check runs.

MCP clients

Endpoint https://mcp.x9si.com/mcp, streamable HTTP, 23 of 28 tools live (which ones). Three headers: the two Access headers and Authorization: Bearer x9k_.... A hand written client also sends Accept: application/json, text/event-stream. Keep the values in environment variables X9_CF_ID, X9_CF_SEC and X9_API_KEY.

Claude Code (staging)
claude mcp add --transport http x9-staging https://mcp.x9si.com/mcp \
  --header "CF-Access-Client-Id: $X9_CF_ID" --header "CF-Access-Client-Secret: $X9_CF_SEC" --header "Authorization: Bearer $X9_API_KEY"
Codex (staging)
[mcp_servers.x9-staging]
url = "https://mcp.x9si.com/mcp"
env_http_headers = { "CF-Access-Client-Id" = "X9_CF_ID", "CF-Access-Client-Secret" = "X9_CF_SEC" }
bearer_token_env_var = "X9_API_KEY"
Cursor (staging)
{ "mcpServers": { "x9-staging": { "url": "https://mcp.x9si.com/mcp", "headers": {
  "CF-Access-Client-Id": "${env:X9_CF_ID}", "CF-Access-Client-Secret": "${env:X9_CF_SEC}", "Authorization": "Bearer ${env:X9_API_KEY}" } } } }
Claude Desktop (staging)
{ "mcpServers": { "x9-staging": { "command": "npx", "args": ["-y", "[email protected]", "https://mcp.x9si.com/mcp",
  "--header", "CF-Access-Client-Id:${X9_CF_ID}", "--header", "CF-Access-Client-Secret:${X9_CF_SEC}", "--header", "Authorization:Bearer ${X9_API_KEY}"],
  "env": { "X9_CF_ID": "<client id>", "X9_CF_SEC": "<client secret>", "X9_API_KEY": "x9k_..." } } } }

The Cursor shape with headers also works for Windsurf, Cline, Zed and VS Code Copilot (VS Code writes ${NAME} instead of ${env:NAME}). Gemini CLI takes the same three headers under httpUrl in settings.json.

Not supported yet: ChatGPT (no custom headers, OAuth only) and claude.ai web connectors (custom header names need approval).