AI Machines

One-click deploy of a GPU running an LLM. Pick a model, pick a mode, and the machine comes up serving inference. Deployed and managed entirely with x402 payments — an agent with a funded wallet can run the whole lifecycle with no human.

🖥️ Deploy and manage AI Machines through the compute control API at compute.x402layer.cc

AI Machines are the Standard tier. They are not confidential/TEE machines. For confidential (TEE) inference, use SGL Grid confidential inference.

Two modes

You choose one of two modes at deploy time.

🔒 Private

Your own OpenAI-compatible endpoint. Just for you. The UI shows an endpoint URL (http://<ip>:8080/v1) and an API key.

🖧 Join the grid & earn

Serve the network as a node and earn USDC + SGL. Requires 50,000 SGL staked.

Private mode — your own endpoint

The machine runs llama-server (llama.cpp), which auto-exposes an OpenAI-compatible API on port 8080. The UI shows you an endpoint URL (http://<ip>:8080/v1) and an API key (sent as Authorization: Bearer <api_key>). Both /v1/chat/completions and /v1/models are served — so the endpoint is OpenRouter-ready and works with any OpenAI-compatible client, app, agent, or router.

from openai import OpenAI

client = OpenAI(
    base_url="http://<ip>:8080/v1",     # from the UI
    api_key="<your-ai-machine-key>",     # from the UI
)

resp = client.chat.completions.create(
    model="<model-id>",
    messages=[{"role": "user", "content": "Hello from my AI Machine"}],
)
print(resp.choices[0].message.content)
# Discover the served model
curl http://<ip>:8080/v1/models \
  -H "Authorization: Bearer <your-ai-machine-key>"

# Chat
curl http://<ip>:8080/v1/chat/completions \
  -H "Authorization: Bearer <your-ai-machine-key>" \
  -H "Content-Type: application/json" \
  -d '{"model": "<model-id>", "messages": [{"role": "user", "content": "hi"}]}'

Your endpoint works with any OpenAI-compatible client today. Listing it on OpenRouter as a public provider is a separate approval through OpenRouter's own form — roadmap, not automatic.

Join the grid & earn

Deploy the machine as a network node instead of a private endpoint. It serves grid traffic and earns USDC + SGL. This mode requires 50,000 SGL staked.

GPU machines & regions

AI Machines run on GPU machines across multiple cloud providers and regions. You pick the plan and region at deploy time; the network places the workload.

Fully managed

♻️ Auto-update

Deployed machines keep themselves current (allowlist-gated, roughly every 6 hours).

🫀 Kept alive

The serving process is supervised and restarted (systemd) if it exits.

🔑 SSH access

You can still SSH in with the instance IP and a one-time root password from the UI/API.

Billing

AI Machines bill by prepaid hours. The machine runs while it has prepaid time; extend it to keep it alive (extend uses extend_hours), or destroy it to stop billing. Payment is x402-native (MPP too). Private AI Machines require an x402 wallet payment; prepaid USD credits apply to bare and grid machines.

Control API

Base URL: https://compute.x402layer.cc

AI Machines use the same compute control API as x402Compute, with one extra nested object on provision that selects the mode (the two are mutually exclusive): ai_machine: { model_id, mode: "private" } for your own endpoint, or deploy_node: { model_id } to join the grid. os_id is the provider GPU image id from the catalog. Private AI Machines require an x402 wallet paymentuse_credits is not accepted for ai_machine.

MethodEndpointDescription
POST/compute/provisionDeploy (add nested ai_machine or deploy_node for AI Machines)
GET/compute/instancesList your machines
GET/compute/instances/:idGet machine status
POST/compute/instances/:id/extendExtend runtime — the most important lifecycle call
POST/compute/instances/:id/resizeResize in place
POST/compute/instances/:id/passwordOne-time root password (SSH)
DELETE/compute/instances/:idDestroy the machine
POST/compute/credits/topupTop up prepaid credits via x402

Deploy an AI Machine

curl -X POST https://compute.x402layer.cc/compute/provision \
  -H "Content-Type: application/json" \
  -H "X-Payment: <base64-signed-payment-payload>" \
  -d '{
    "plan": "<gpu-plan-id>",
    "region": "<region>",
    "os_id": <provider-gpu-image-id>,
    "prepaid_hours": 720,
    "network": "base",
    "ai_machine": { "model_id": "<model-id>", "mode": "private" }
  }'

The response includes an ai object with your endpoint details:

{
  "ai": {
    "model_id": "<model-id>",
    "api_key": "<your-ai-machine-key>",
    "port": 8080,
    "endpoint": "<endpoint>"
  }
}

The private endpoint is OpenAI-compatible at <endpoint>/v1. For VM providers the endpoint derives from the instance IP and port (http://<ip>:8080/v1) once the IP lands. Authenticate with Authorization: Bearer <api_key>.

Extend (keep it alive)

Extend uses extend_hours (not prepaid_hours):

curl -X POST https://compute.x402layer.cc/compute/instances/<id>/extend \
  -H "Content-Type: application/json" \
  -H "X-Payment: <base64-signed-payment-payload>" \
  -d '{ "extend_hours": 24, "network": "base" }'

An agent deploys + extends a machine via x402

The whole compute API is x402-native, so an agent with a funded wallet can run the full lifecycle with no human. Call a paid endpoint without payment and the server answers 402 with a challenge; the agent settles and retries with an X-Payment header.

1. Call without payment → 402

curl -i -X POST https://compute.x402layer.cc/compute/provision \
  -H "Content-Type: application/json" \
  -d '{
    "plan": "<gpu-plan-id>",
    "region": "<region>",
    "os_id": <provider-gpu-image-id>,
    "prepaid_hours": 720,
    "network": "base",
    "ai_machine": { "model_id": "<model-id>", "mode": "private" }
  }'

# HTTP/1.1 402 Payment Required
# { "x402": { "network": "base", "amount": "...", "payTo": "...", "asset": "..." } }

2. Sign the payment, retry with X-Payment → provisioned

# The agent builds and signs the payment from the 402 challenge,
# then retries the same request with the X-Payment header:
curl -X POST https://compute.x402layer.cc/compute/provision \
  -H "Content-Type: application/json" \
  -H "X-Payment: <base64-signed-payment-payload>" \
  -d '{
    "plan": "<gpu-plan-id>",
    "region": "<region>",
    "os_id": <provider-gpu-image-id>,
    "prepaid_hours": 720,
    "network": "base",
    "ai_machine": { "model_id": "<model-id>", "mode": "private" }
  }'
# → 201 Created — provisioning started

3. Keep it alive — extend (same 402 → X-Payment flow)

# 1) 402 challenge (extend uses extend_hours, not prepaid_hours)
curl -i -X POST https://compute.x402layer.cc/compute/instances/<id>/extend \
  -H "Content-Type: application/json" \
  -d '{ "extend_hours": 24, "network": "base" }'

# 2) settle + retry
curl -X POST https://compute.x402layer.cc/compute/instances/<id>/extend \
  -H "Content-Type: application/json" \
  -H "X-Payment: <base64-signed-payment-payload>" \
  -d '{ "extend_hours": 24, "network": "base" }'

MPP clients use Authorization: Payment instead of the x402 X-Payment header. Bare and grid machines can also pay from prepaid credits — top up once (POST /compute/credits/topup) and pass "use_credits": true. Private AI Machines do not accept credits; they require an x402 wallet payment.

Resources