Build for AI agents
Give an agent bounded server access and a reliable credit-funding workflow.
Start an agent with layerbeat.com/llms.txt, a short brief on what Layerbeat sells and how to buy it, and layerbeat.com/pricing.md, the live price list with plan IDs. See Pricing.
To let Claude Code, Codex, Cursor or opencode manage Layerbeat as tools, see Agents and MCP. An agent can also use the same API and CLI as a person. Give it a dedicated API key, explicit spending limits and durable request identities. A key's purchases and top-ups act on its creator's personal credit.
Give the agent a narrow role
Create a key in the workspace where the agent should operate. Use vm:read and vm:write for server management; add ssh_key:write if it will register keys. Add billing scopes only when it needs to inspect or fund personal credit.
If it needs metrics, grant its key access to specific servers through the metrics access list.
Make purchases predictable
Read and quote
Fetch available catalog IDs, request a quote in one currency and compare the full term total with the user's spending policy. Do not assume a plan name or old price is still valid.
Fund credit when authorized
If the selected balance is insufficient, request a top-up through the approved payment method. Wait for confirmed credit before submitting a purchase. The wallet authorization belongs in your agent's secure payment integration, not in Layerbeat's API key.
Submit and follow the original operation
Persist the request body and idempotency key before sending. Save the server and operation IDs, then poll the operation. Recover lost responses with the original request identity.
With the CLI, new --max-price supplies a spending guard, --idempotency-key supplies the retry identity and --wait follows the operation. Use --json and --no-input for automation.
Top up using x402
For pay.sh and MPP on Tempo, see Agent payments.
Layerbeat supports x402 V2 exact USDC top-ups on the configured Solana network. This endpoint funds USD credit; it does not directly pay for a particular VPS.
| Step | Request or result |
|---|---|
| Request requirements | POST /v1/billing/top-ups/x402 with {"amount":"5.00"} and a saved Idempotency-Key |
| Inspect requirements | 402 with the payment requirements in the body and PAYMENT-REQUIRED header |
| Authorize | Prepare the exact offered USDC transaction using the specified network, mint, recipient, fee payer and memo |
| Submit | Repeat the same body and key with the base64-encoded x402 payload in PAYMENT-SIGNATURE |
| Confirm | 201 means finalized credit; 202 means pending credit—poll the saved payment |
The initial x402 request still needs a Layerbeat bearer token with billing:write. Save extensions.layerbeat.info.payment_id from the requirements. The offered amount is an integer in micro-USDC, including the original payment's attribution suffix.
The current transaction profile supports regular-wallet native USDC checked transfers. Smart-wallet transactions and address lookup tables are not supported. Use the offered requirements instead of constructing a different transfer or removing its memo.
Recover without paying twice
After an uncertain submission, poll GET /v1/billing/payments/{id} or replay the original x402 request with the same key. Do not authorize a replacement transfer just because an HTTP response was lost.
Wallet or facilitator success alone is not spendable credit. Only the confirmed backend receipt updates the wallet. Keep payment authorizations, API keys and signed payloads out of agent transcripts and logs.
The docs also provide llms.txt, full Markdown and a copy-Markdown control on each page for your integration's context.