Skip to main content

Sign up, top up, rent

  1. Read GET /api/v1/terms and the linked Terms. POST /api/v1/signup with a new UUID Idempotency-Key and termsAcceptance: {accepted:true, version:<current version>, sha256:<current hash>}. No Telegram, email, browser login or per-rental human approval is involved. Save data.token securely: this AGENT key is returned once and cannot be recovered. It has read, rent, manage and billing scopes; its spending and concurrency limits still apply.
  2. With Authorization: Bearer <agent key>, POST /api/v1/billing/machine-topups using a stable Idempotency-Key and {amountMinor:1000, termsAcceptance:{accepted:true,version:<current version>,sha256:<current hash>}}. Read data.paymentMethods, each containing method, protocol and url. Enabled methods fund the same account: Base USDC via x402, Solana via MPP, Tempo via MPP. Hosted card top-ups use POST /api/v1/billing/topups where enabled. Minimum $5, maximum $500. The legacy data.paymentUrl remains the Tempo URL.
  3. POST to the chosen paymentMethods[].url with X-Ukiyo-Api-Key: <agent key>. For Base, the first 402 returns PAYMENT-REQUIRED, a base64 JSON object containing x402Version, resource.url and accepts[]. Use an x402 client to sign the accepted USDC TransferWithAuthorization (amount, payTo, asset, network and timeout from that challenge). Retry the SAME URL with the resulting base64 payment payload in PAYMENT-SIGNATURE, keeping X-Ukiyo-Api-Key. Do not use Authorization: Payment on Base. For Tempo/Solana, the 402 returns WWW-Authenticate: Payment; an MPP client signs the challenge and retries the SAME URL with Authorization: Payment <credential> and X-Ukiyo-Api-Key. Preserve the original payment on retry; never sign another while settlement is pending.
  4. A 202 with settlementPending:true means settlement is unresolved: do not pay again. Poll GET /api/v1/billing/machine-topups/{topUpId} with Authorization: Bearer <agent key> until data.status is SUCCEEDED, or check GET /api/v1/billing/balance. A credited retry returns the same top-up view. A new payment after expiry returns TOPUP_EXPIRED; a verified payment that already settled is still credited exactly once even if reconciliation occurs after expiry. PAYMENT_METHOD_DISABLED names the enabled rails. Refresh the payment-method list rather than guessing a recipient or paying an unadvertised rail.
  5. Read live GET /api/v1/offers and POST /api/v1/rentals with the same agent key, a stable Idempotency-Key, and either an explicit offerId or gpuModel/gpuCount/maxHourlyPriceMinor. GET /api/v1/me identifies the billing model: ACCOUNT_BALANCE needs no per-rental budget; LEGACY_PREPAID requires budgetMinor. Keep the returned rentalId/deploymentId, wait for ACTIVE, use the existing credentials/execution interface, and terminate when finished. Spending limits and admission remain enforced.
Worked example: an initially empty account creates a $10.00 top-up with amountMinor:1000. A Base 402 quotes amount:"10000000" (6-decimal USDC), the configured network/asset/payTo, and bounded authorization validity. The agent signs that authorization through its x402 wallet and retries the exact top-up URL. After verified settlement, GET /api/v1/billing/balance returns availableMinor:1000 and currency:"USD", before any rental usage. The same settlement or request replay does not add another $10.00. A top-up funds credits, not purchased GPU time or an extra data allowance. Single machine purchases retain their published 50 GB + 10 GB/hour allowance, capped at 200 GB. Account balance is the path for repeated rentals. /api/machine/gpu-blocks and /api/machine/gpu-jobs remain single-purchase paths: a payment for one cannot be used for an account top-up, or vice versa. Retry each payment only at its own challenged URL. Standard EIP-3009 signatures authorize the transfer, not arbitrary HTTP metadata; keep payment credentials private.