Quickstart
Rent one H100 for two hours with a budget of 8 USDC. You need a wallet holding USDC and, ideally, an x402 client.
With an x402 client
An x402 client catches the 402, signs the payment and repeats the call for you. This is the shortest path.
import os, requests
from x402.clients.requests import x402_requests # any x402 client works
from eth_account import Account
wallet = Account.from_key(os.environ["AGENT_KEY"]) # the agent's own wallet
session = x402_requests(wallet) # pays 402s automatically
r = session.post("https://api.obsyd.online/v1/jobs", json={
"gpu": "H100", "count": 1, "hours": 2, "max_usd": 8,
"image": "pytorch/pytorch:latest",
})
job = r.json()
print(job["job"], job["status"], job["cloud"])import { wrapFetchWithPayment } from "x402-fetch"; // any x402 client works
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(process.env.AGENT_KEY as `0x${string}`);
const pay = wrapFetchWithPayment(fetch, account); // pays 402s automatically
const res = await pay("https://api.obsyd.online/v1/jobs", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ gpu: "H100", count: 1, hours: 2, max_usd: 8 }),
});
const job = await res.json();
console.log(job.job, job.status, job.cloud);By hand, step by step
1. Ask for a GPU
curl -s -X POST https://api.obsyd.online/v1/jobs \
-H "content-type: application/json" \
-d '{"gpu":"H100","count":1,"hours":2,"max_usd":8}'2. Read the quote
Obsyd answers 402 Payment Required. The body says what to pay, in which asset, on which network, to which address, and which cloud it picked.
HTTP/1.1 402 Payment Required
{
"x402Version": 1,
"accepts": [{
"scheme": "exact",
"network": "elysium",
"asset": "USDC",
"maxAmountRequired": "3630000",
"payTo": "0x…",
"resource": "https://api.obsyd.online/v1/jobs",
"description": "1x H100 · 2h · cloud $1.65/h + 10%",
"maxTimeoutSeconds": 60
}],
"quote": {
"cloud": "…", "region": "us-east",
"cloud_usd_per_hour": 1.65, "our_usd_per_hour": 1.815,
"total_usdc": "3.630000", "expires_in": 60
}
}3. Pay and send again
Sign a payment for maxAmountRequired and repeat the exact same request with it in the X-PAYMENT header.
curl -s -X POST https://api.obsyd.online/v1/jobs \
-H "content-type: application/json" \
-H "X-PAYMENT: $SIGNED_PAYMENT" \
-d '{"gpu":"H100","count":1,"hours":2,"max_usd":8}'HTTP/1.1 200 OK
X-PAYMENT-RESPONSE: eyJ0eCI6IjB4…
{
"job": "job_8f2a",
"status": "booting",
"gpu": "H100", "count": 1,
"cloud": "…", "region": "us-east",
"paid_usdc": "3.630000",
"boot_eta_s": 180,
"ssh": null,
"receipt": null
}4. Wait for the GPU
Poll GET /v1/jobs/job_8f2a every few seconds. When status becomes running you get the SSH command and an HTTPS endpoint. Billing starts at that moment.
Tip
A quote is valid for 60 seconds. If you pay later, the call returns
402 again with a fresh price.Was this page helpful?