TensorGrid docs
Price an AI job, pay for it in USDG on Robinhood Chain, and get the output with a receipt. Pay per call with x402 from any wallet, no account needed, or sign in and pay from prepaid credits with an API key.
Quickstart
Base URL: https://api.tensorgrid.run. Everything is JSON. You do not need a key to read prices or get a quote.
| Network | Robinhood Chain, chain id 4663 (eip155:4663) |
| Currency | USDG, 6 decimals. 3000 base units = 0.003 USDG |
| USDG contract | 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168 |
| Auth | None. TensorGrid never asks for a private key |
1. See the price of a model
curl -s "https://api.tensorgrid.run/api/v1/models/flux-schnell"
const res = await fetch("https://api.tensorgrid.run/api/v1/models/flux-schnell");
console.log(await res.json());import requests
r = requests.get("https://api.tensorgrid.run/api/v1/models/flux-schnell")
print(r.json())2. Get an exact quote
A quote is free. It shows the exact USDG amount and runs the spend checks. Nothing is charged.
curl -s -X POST "https://api.tensorgrid.run/api/v1/quote" \
-H "content-type: application/json" \
-d '{"model":"flux-schnell","payer":"0xYourWallet","prompt":"a GPU on a desk"}'const res = await fetch("https://api.tensorgrid.run/api/v1/quote", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ model: "flux-schnell", payer: "0xYourWallet", prompt: "a GPU on a desk" }),
});
console.log(await res.json());import requests
r = requests.post("https://api.tensorgrid.run/api/v1/quote", json={
"model": "flux-schnell", "payer": "0xYourWallet", "prompt": "a GPU on a desk",
})
print(r.json())3. Pay and run
Call the x402 route. The first call answers 402 with the price and where to pay. Pay from your wallet, then send the same call again with the proof in an X-PAYMENT header. The answer is the finished job, its output and its receipt.
# 1. ask: answers 402 with accepts[] curl -s -X POST "https://api.tensorgrid.run/api/v1/x402/flux-schnell" \ -H "content-type: application/json" \ -d '{"payer":"0xYourWallet","prompt":"a GPU on a desk"}' # 2. pay maxAmountRequired USDG to payTo from 0xYourWallet, keep the tx hash # 3. retry with proof. X-PAYMENT is base64 of: # {"x402Version":1,"scheme":"usdg-transfer","network":"eip155:4663","payload":{"tx_hash":"0x...","quote_token":"eyJ..."}} curl -s -X POST "https://api.tensorgrid.run/api/v1/x402/flux-schnell" \ -H "content-type: application/json" \ -H "X-PAYMENT: $PAYMENT" \ -H "Idempotency-Key: first-run-1" \ -d '{"payer":"0xYourWallet","prompt":"a GPU on a desk"}'
const url = "https://api.tensorgrid.run/api/v1/x402/flux-schnell";
const body = JSON.stringify({ payer: "0xYourWallet", prompt: "a GPU on a desk" });
const headers = { "content-type": "application/json" };
// 1. ask: answers 402 with the price
const ask = await (await fetch(url, { method: "POST", headers, body })).json();
const req = ask.accepts.find((a) => a.scheme === "usdg-transfer");
// 2. pay with your own wallet code (TensorGrid never sends money for you)
const txHash = await payWithWallet(req.payTo, req.maxAmountRequired);
// 3. retry with proof
const payment = btoa(JSON.stringify({ x402Version: 1, scheme: "usdg-transfer", network: "eip155:4663",
payload: { tx_hash: txHash, quote_token: req.extra.quote_token } }));
const job = await (await fetch(url, { method: "POST", body,
headers: { ...headers, "X-PAYMENT": payment, "Idempotency-Key": crypto.randomUUID() } })).json();
console.log(job.status, job.output, job.receipt);import base64, json, uuid, requests
url = "https://api.tensorgrid.run/api/v1/x402/flux-schnell"
body = {"payer": "0xYourWallet", "prompt": "a GPU on a desk"}
ask = requests.post(url, json=body).json() # 402
req = next(a for a in ask["accepts"] if a["scheme"] == "usdg-transfer")
tx_hash = pay_with_wallet(req["payTo"], req["maxAmountRequired"]) # your wallet code
payment = base64.b64encode(json.dumps({
"x402Version": 1, "scheme": "usdg-transfer", "network": "eip155:4663",
"payload": {"tx_hash": tx_hash, "quote_token": req["extra"]["quote_token"]},
}).encode()).decode()
job = requests.post(url, json=body, headers={"X-PAYMENT": payment, "Idempotency-Key": str(uuid.uuid4())}).json()
print(job["status"], job["output"], job["receipt"])If a part is not enabled on a host, paid calls stop before any payment is asked for. For model runs the answer is 503 runs_opening_soon. Check What is live first.
What is live
This table is updated from GET /api/v1/status when the page loads. The full history is on the status page.
| Part | Status | Note |
|---|---|---|
| GPU prices | Operational | Weekly GPU market price data, served from cache |
| USDG payment check | Operational | Verifies on-chain USDG transfers on chain 4663 |
| Spend cap | Operational | Checked when the payer commits to pay |
| 2-of-3 checkers | Operational | Spend cap, recipient and amount, and request rate checks on every quote. 2 of 3 must approve |
| Paid AI runs | Operational | Pay per output in USDG with a usdg-transfer, a signed payment or prepaid credits |
| Signed payments (EIP-3009) | Operational | Signed EIP-3009 payments are verified here and submitted by our relayer on Robinhood Chain, which pays the ETH gas |
| Receipt anchoring | Operational | Every paid job's receipt hash is written to Robinhood Chain, with an explorer link in the receipt |
| GPU launch | Operational | Rent a GPU from your credits or with a one-off USDG payment, billed per second once the GPU is ready |
Status words: Operational (working), Degraded (working with problems), Outage (not working), Disabled (built, switched off), Scheduled (not enabled yet), Restricted (owner only).
Pricing and models
You pay per output in USDG: the model's list price plus our 10% margin. The prices below include it. Units are rounded up to whole units, for example per image, per second or per 1,000 characters. The quote always shows the exact amount before you pay. Prices were checked on 2026-11-27.
| model | Task | Inputs | Price |
|---|---|---|---|
| flux-schnell | Text to image | prompt + size, num_images | $0.0033 / megapixel |
| z-image-turbo | Text to image | prompt + size, num_images | $0.0055 / megapixel |
| nano-banana | Text to image | prompt + aspect_ratio, num_images | $0.0438 / image |
| nano-banana-2 | Text to image | prompt + aspect_ratio, num_images | $0.088 / image |
| nano-banana-pro | Text to image | prompt + aspect_ratio, num_images | $0.165 / image |
| nano-banana-edit | Image editing | image_url prompt + num_images | $0.0438 / image |
| flux-kontext-pro | Image editing | image_url prompt + num_images | $0.044 / image |
| bria-remove-background | Background removal | image_url | $0.0198 / image |
| recraft-crisp-upscale | Upscaling | image_url | $0.0044 / image |
| bria-increase-resolution | Upscaling | image_url + scale | $0.044 / image |
| kling-2.5-turbo-pro-t2v | Text to video | prompt + duration, aspect_ratio | $0.077 / second |
| kling-2.5-turbo-pro-i2v | Image to video | image_url prompt + duration | $0.077 / second |
| kling-2.5-turbo-std-i2v | Image to video | image_url prompt + duration | $0.0462 / second |
| elevenlabs-tts-turbo-v2.5 | Text to speech | text + voice | $0.055 / 1k chars |
| elevenlabs-tts-multilingual-v2 | Text to speech | text + voice | $0.11 / 1k chars |
| minimax-speech-2.8-turbo | Text to speech | text + voice | $0.066 / 1k chars |
| elevenlabs-sound-effects-v2 | Sound effects | prompt + duration | $0.0022 / second |
| ace-step-music | Music | prompt + duration, instrumental | $0.00022 / second |
| elevenlabs-scribe-v2 | Speech to text | audio_url + audio_seconds | $0.0088 / minute |
| trellis-image-to-3d | Image to 3D | image_url | $0.022 / generation |
GPU prices are free to read: GET /api/v1/gpus for weekly price ranges per GPU type and GET /api/v1/gpu/offers for live offers you can rent. GET /api/v1/gpu/summary has the counts for both; they count different things, so show each with its label.
Model inputs
Send inputs as top-level fields next to model and payer. GET /api/v1/models/{id} lists each model's inputs, limits and defaults.
| Field | Used by |
|---|---|
| prompt | Image, image edit, video, sound and music models |
| text | Text to speech, billed per 1,000 characters |
| image_url | Image edit, image tools, image to video, image to 3D. Public https link |
| audio_url | Speech to text. We measure the file and you pay per started minute |
| size, num_images, aspect_ratio, duration, voice | Options for some models |
How paying works
- You ask for a job. TensorGrid prices it and checks the payer's spend cap.
- You get
402with the amount, the address to pay (payTo) and a signedquote_token. - The payer sends USDG on Robinhood Chain, or signs a payment.
- You send the same request again with
X-PAYMENT. - TensorGrid confirms the payment on chain, runs the model and returns the output and a receipt.
Rules
- The quoted price is final for that request. Change an input and you need a new quote.
- Quotes last 600 seconds.
- Each quote, transfer and signature works once.
- Send the exact amount. Extra USDG is not returned automatically.
- If a job fails after payment, it is marked
failed_refund_dueand refunded to the payer. In this version refunds are made by hand.
Pay with a transfer
Scheme usdg-transfer works with any wallet. Send the amount, wait until it is mined, then send the tx hash.
{
"x402Version": 1,
"scheme": "usdg-transfer",
"network": "eip155:4663",
"payload": { "tx_hash": "0x<64 hex>", "quote_token": "from accepts[].extra.quote_token" }
}Not mined yet? You get 402 tx_not_found with retryable: true. Retry with the same Idempotency-Key.
Pay with a signature
Live on Robinhood Chain. Signed payments appear in the 402 as a second entry in accepts with scheme: "exact", and in GET /.well-known/x402 under schemes. Always pick the scheme from the 402 you got: if our relayer is ever low on gas, the 402 lists only usdg-transfer and adds exact_status: "paused", and a signed payment sent anyway gets 503 exact_scheme_paused with nothing charged. Signed payments switch back on by themselves within about a minute.
Scheme exact uses EIP-3009. The payer signs accepts[scheme=exact].extra.typed_data (a USDG TransferWithAuthorization) with eth_signTypedData_v4 instead of sending a transaction. The payer needs USDG only, no ETH: TensorGrid checks the signatures, then our relayer submits the payment on chain 4663 and pays the gas. The job answer carries the settlement tx in payment_tx and in the X-PAYMENT-RESPONSE header. Test a signature without moving money with POST /api/v1/x402/verify.
Spend cap
Every payer has a running USDG spend cap. It is checked when you commit to pay, before any payment is asked for. A job that would go over the cap gets 403 and nothing is charged. Read the current state with GET /api/v1/policy?payer=0x....
2-of-3 checkers
Every quote also goes through three independent checks before a price is handed out: a daily spend cap per payer, a recipient and amount check (our pay-to address, USDG on chain 4663, the exact computed price, within the per-job limit) and a request rate check. At least 2 of the 3 must approve. The votes and a tg-chk-... id are in the quote's checks. A refused quote gets 403 policy_... and nothing is charged.
Receipts
Every paid, finished job gets a receipt. Its leaf is the keccak256 hash of the receipt fields. GET /api/v1/receipts/{job_id} recomputes it on every call and returns leaf_matches.
The leaf is written to Robinhood Chain without a contract: our relayer wallet 0x893D3cC53d2Ab9B96Ab638Be1125DB0c0158FCe7 sends a 0-value transaction to itself whose input is 0x54475231 ("TGR1") followed by the 32-byte leaf. The receipt's anchor has the tx hash and explorer link, and anchor_check re-reads that tx from the chain and confirms the sender and the input.
Runs are private. There is no public list of receipts or jobs. GET /api/v1/receipts lists only your own, with your session or API key. A job, its receipt and its output files (credit runs and x402 runs alike) open only with the payer's session or API key, or with the signed link returned when you paid: ?exp=<unix seconds>&sig=.... Each paid response has a links block with job_url, receipt_url and expires_at. Links last 7 days by default; after that, sign in or use your API key. A bare job_id without either returns 404. Anyone can check a receipt hash with GET /api/v1/receipts/verify/{leaf}: it recomputes the leaf and reads the anchor transaction, and shows no wallet and no job id.
Measured stats. GET /api/v1/models/{model}/stats returns counts from finished paid runs on TensorGrid: runs, succeeded, failed, success_rate, p50_ms and p90_ms. Timing and success rate stay null until a model has 5 runs (enough_data). GET /api/v1/stats/public returns totals only: paid runs, anchored receipts, the newest anchor and 14 days of daily counts. Neither shows wallets, prompts or job ids.
Sign in with your wallet
Your wallet is your account. There is no email or password: you sign one message (no transaction, no gas) and get a session token. In the app, press Sign in. With the API:
POST /api/v1/auth/noncewith{"address":"0xYourWallet"}. The answer has anonceand a sign-inmessagefor Robinhood Chain (4663). It expires in 10 minutes and works once.- Sign the exact
messagewithpersonal_sign. Smart contract wallets (ERC-1271) work too. POST /api/v1/auth/verifywith{"nonce":"...","signature":"0x..."}. You get a sessiontoken(starts withtgs_) and when it expires (7 days by default).- Send it as
Authorization: Bearer tgs_...on account routes.X-TensorGrid-Tokencarries the same token when your Authorization header is already in use.DELETE /api/v1/auth/sessionsigns out.
Only a hash of each token is stored. Account routes only ever show data for the signed-in wallet: GET /api/v1/account/jobs lists jobs paid by that wallet, and no other.
Credits and billing
Credits are prepaid USDG held for your wallet. Add them once and every model run or GPU rental is paid from the balance in one click, with no wallet popup. Paying per call with x402 still works the same as before.
Add credits
- Send USDG on Robinhood Chain from your signed-in wallet to the pay-to address in
GET /api/v1/account(deposit.pay_to). The minimum is 0.01 USDG. POST /api/v1/account/depositswith{"tx_hash":"0x..."}. The server reads the transfer from the chain: the sender must be your wallet, the receiver the pay-to address, and the transfer at most 7 days old. Each transfer can be used once, for one thing.- Before one confirmation the answer is
409withretryable: true. Try again after a few seconds. The app does this for you.
The ledger
Every change to a balance is an entry in an append-only ledger. Entries are never edited or deleted. Your balance has two parts: available and held.
| Entry | What happens |
|---|---|
| deposit | A verified USDG transfer adds to available |
| hold | Moves the price of a run, a GPU rental or a withdrawal from available to held |
| spend | Charges from the hold when the output is ready, or for the GPU seconds used |
| release | Returns the unused part of a hold to available (failed run, stopped GPU, cancelled withdrawal) |
| refund | Moves a failed x402 payment into credits, once per job |
| withdraw | A withdrawal paid on chain |
| sample | Your one free sample run. Amount 0, no balance change |
GET /api/v1/account/ledger lists entries newest first, 100 per page (?page=). GET /api/v1/account/ledger.csv exports all of them. GET /api/v1/account/invoices/{entry_id} returns an invoice for one deposit, charge, refund or withdrawal (HTML, or ?format=json).
One free sample run
Each new signed-in wallet can take one free sample run on flux-schnell (one image, square_hd), paid by TensorGrid. In the app, press Try one free run. With the API, GET /api/v1/account/sample shows whether your wallet can still use it, and POST /api/v1/account/sample with {"prompt":"..."} runs it (session only).
- One per wallet, ever, and one per network per day (an IPv4 address or an IPv6 /64).
- A daily budget covers all free samples together. When it runs out the answer is
429 samples_used_up: "Free samples are used up for today." - The ledger gets a
sampleentry with amount 0. No USDG moves and no receipt is anchored. If the run fails, your sample stays available. - It is one sample, not a free tier. Every other run is paid.
Run a model from credits
POST /api/v1/account/runs with the same body as a quote (model and its inputs). It runs the same checkers and spend cap, holds the price, runs the model and charges the hold only when the output is ready. If the run fails, the hold is released and nothing is charged. Send an Idempotency-Key so a retry never runs twice.
Failed x402 runs
If a job you paid by x402 failed after payment (failed_refund_due), POST /api/v1/account/refunds with its job_id moves the payment into your credits. This works once per job and only for the wallet that paid.
Withdrawals
Unused credits can go back to your wallet. POST /api/v1/account/withdrawals with {"amount_usdc":"2.5"} holds the amount and creates a request. Each request is reviewed and paid on chain by the operator from the pay-to wallet, usually within 24 hours, to the wallet you signed in with. The server checks the payout transfer on chain before it records the withdraw entry. While a request is pending you can cancel it with DELETE /api/v1/account/withdrawals/{id}, which releases the hold. GET /api/v1/account/withdrawals lists your requests.
Delete your account
In the app, open Settings and use Delete account, or call DELETE /api/v1/account with {"confirm":"DELETE"} from a signed-in session. It is refused while credits are held (held_funds), a withdrawal is pending (withdrawal_pending), a GPU rental is running (rental_active) or any balance is left (balance_remaining: withdraw it first).
Deleting revokes your API keys and deletes your SSH keys, your sessions and your saved settings. The ledger is append-only and invoices are kept for accounting: they stay under a random id without your wallet address. Signing in again later with the same wallet starts a new, empty account; the free sample is still counted as used.
Get USDG on Robinhood Chain
Credits are paid in USDG, a US dollar stablecoin, on Robinhood Chain. You need USDG in the same wallet you sign in with, plus a little ETH on Robinhood Chain for gas.
- Add the network. In the app, open Add credits and press Add network, or add it by hand: chain id
4663, currency ETH, RPChttps://rpc.mainnet.chain.robinhood.com, explorerhttps://robinhoodchain.blockscout.com. - Bring funds to Robinhood Chain. Move ETH or USDG to your wallet on chain 4663, for example with a bridge or an exchange that supports withdrawals to Robinhood Chain.
- Swap for USDG if needed. USDG is token
0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168(6 decimals). Check the address on the explorer before you swap or send. TensorGrid does not swap for you. - Add credits. Back in the app, choose an amount and press Send from wallet. If the wallet holds less USDG than the amount, the button says so and stays off.
Questions: message @runtensorgrid on X.
API keys
An API key lets an app or agent spend your credits without your wallet. Create keys in the app under Account, API keys, or with POST /api/v1/account/keys and {"name":"my agent","daily_cap_usdc":"5"}. The secret (starts with tgk_) is shown once; only its hash is stored.
- Send
Authorization: Bearer tgk_...to/api/v1/account/runs,/api/v1/account/gpu/rentals,/api/v1/accountand/api/v1/account/jobs. - Each key has a daily spend cap (default 5 USDG, at most 50). Over the cap the call answers
403 key_daily_capbefore anything is held. PATCH /api/v1/account/keys/{id}changes the name, the cap or switches the key off ({"disabled":true}).DELETErevokes it for good.- Kill switch:
POST /api/v1/account/keys/pausewith{"paused":true}stops every key on the account at once. - Keys cannot add credits, withdraw, or manage other keys. Those need a signed-in session.
curl https://api.tensorgrid.run/api/v1/account/runs \
-H "authorization: Bearer $TENSORGRID_API_KEY" \
-H "content-type: application/json" \
-H "idempotency-key: run-001" \
-d '{"model":"flux-schnell","prompt":"a red cube on a white table"}'GPU rentals
From credits, billed per second
Signed in (or with an API key), rent any GPU from the live offers list and pay from your credits for the seconds it runs. Billing starts when the machine is ready, so boot time is free, and a rental that never becomes ready is refunded in full. One running rental per account; its SSH key is removed when it ends. Each offer in GET /api/v1/gpu/offers shows our_usdc_per_hour: the provider's hourly price plus our margin. Offers above the per-hour price cap for rentals have rentable: false; renting one returns 403 over_price_cap and nothing is charged.
POST /api/v1/account/gpu/rentalswithinstance_type,cloud,region, yourssh_public_key, and optionallymax_minutesandidle_stop_minutes.- Your balance must cover at least 10 minutes. The server holds credits for up to
max_minutes(or as much time as your balance covers) and launches the machine. GET /api/v1/account/gpu/rentals/{job_id}shows the state, the SSH command, a Jupyter tunnel command and ameterwith seconds and cost so far.GET /api/v1/account/gpu/rentalslists yours.DELETE /api/v1/account/gpu/rentals/{job_id}stops it. You are charged for the seconds from launch to stop, and the rest of the hold goes back to your balance.
It stops by itself when the held time or credits are used up. With idle_stop_minutes set, it also stops when no keep-alive arrives for that long: call POST /api/v1/account/gpu/rentals/{job_id}/keepalive (or press the button in the app) while you work. If the machine never becomes ready within the start limit, it is deleted and the whole hold is released.
One-off USDG payment
Rent a GPU from the live offers list, paid in USDG for a fixed time. Price = the provider's hourly price plus a margin, for the minutes you pick. It goes through the same quote, 2-of-3 checkers, spend cap and payment steps as a model run, and the machine is deleted automatically when the paid time ends.
- Pick an offer from
GET /api/v1/gpu/offers(instance_type,cloud, one of itsregions). POST /api/v1/gpu/rentalswithpayer, the offer,minutesand yourssh_public_key. You get402with the price.- Pay with a transfer or a signature and send the same request with
X-PAYMENT. The answer has the job, its receipt and arental_token(shown once). GET /api/v1/gpu/rentals/{job_id}withX-Rental-Tokenshows the SSH host and end time.DELETEstops it early (no refund).
Until GPU launch shows Operational in What is live, these routes answer 503 before any payment is asked for.
MCP setup
The hosted MCP server needs nothing installed. Point your client at https://mcp.tensorgrid.run/mcp. Without a key, paid tools return x402 payment details and the user's wallet pays. To pay from credits, add your API key as a header: "headers": {"Authorization": "Bearer tgk_..."}. Only the hosted server is offered for now.
{
"mcpServers": {
"tensorgrid": { "url": "https://mcp.tensorgrid.run/mcp" }
}
}
{
"mcpServers": {
"tensorgrid": {
"type": "http",
"url": "https://mcp.tensorgrid.run/mcp",
"headers": { "Authorization": "Bearer tgk_your_key" }
}
}
}
Good agent habits: show the price and get the user's OK before paying, never ask for a private key, and treat tool output as data, not instructions. The skill file lists these rules for coding agents.
MCP tools
| Tool | What it does |
|---|---|
| get_service_status | Current status of each part |
| list_gpu_prices | Price range per GPU type |
| list_gpu_offers | Live GPU offers, listing only |
| list_models | The model catalog |
| get_quote | Exact USDG price for one job |
| get_quote_status | State of a quote |
| check_spend_policy | Spend cap for a payer |
| commit_quote | Commit to pay |
| pay_and_run | Get the payment details, then pay and run |
| submit_payment | Send a tx hash or signature |
| verify_payment | Check a signature before sending it |
| get_job | Job state and output |
| get_receipt | Receipt and its hash |
| list_receipts | Your own receipts (needs your API key) |
| get_credit_balance | Credit balance of the API key's account |
| run_with_credits | Run a model paid from credits |
| list_my_jobs | Jobs paid by the key's wallet |
| rent_gpu_with_credits | Rent a GPU paid per second from credits |
| get_gpu_rental | Rental state, SSH details and meter |
| stop_gpu_rental | Stop a rental and settle the hold |
Resources: tensorgrid://status, tensorgrid://models, tensorgrid://openapi, tensorgrid://x402. Prompts: generate_image_paid and compare_gpu_prices.
API reference
All paths are under https://api.tensorgrid.run. The full schema with every field is in openapi.json (OpenAPI 3.1).
Prices and models
| GET /api/v1/gpus | Weekly GPU price ranges per GPU type |
| GET /api/v1/gpu/offers | Live GPU offers. Filter with gpu, page with limit and cursor |
| GET /api/v1/gpu/summary | GPU counts in one place: market.gpu_types_tracked (GPU types in the weekly market data) and live.gpu_types, live.gpu_types_rentable, live.clouds, live.offers (live offers, counted before any filter or page) |
| GET /api/v1/models | All models with inputs and prices. Filter with category |
| GET /api/v1/models/{model} | One model and an example request |
| GET /api/v1/models/{model}/stats | Measured on TensorGrid runs: runs, success rate and p50/p90 run time. Timing shows only from 5 runs |
| GET /api/v1/stats/public | Aggregate proof: paid runs, receipts anchored, newest anchor tx, 14 days of daily counts. No wallets or prompts |
| POST /api/v1/price | Price preview without a wallet. Nothing is stored |
| POST /api/v1/gpu/quote | Price a GPU rental for a number of minutes. Runs the checkers, no payment |
| POST /api/v1/gpu/rentals | Rent a GPU: 402 first, then pay and launch |
| GET /api/v1/gpu/rentals/{job_id} | Rental state, SSH host and end time. DELETE stops it early. Needs X-Rental-Token |
Quotes, payments and jobs
| POST /api/v1/quote | Exact price and spend checks. Free |
| GET /api/v1/quote/{quote_id} | One quote. Send X-Quote-Token if asked |
| POST /api/v1/quote/{quote_id}/commit | Commit to pay. Checks the spend cap and returns where to pay |
| POST /api/v1/x402/{model} | Pay and run in one route: 402 first, then the job |
| POST /api/v1/x402/verify | Check a signed payment without moving money |
| POST /api/v1/jobs | Pay for a committed quote and run it |
| GET /api/v1/jobs/{job_id} | Job state and output |
| GET /api/v1/receipts | Your own receipts, newest first (session or API key) |
| GET /api/v1/receipts/{job_id} | One receipt, with its hash recomputed. Credit runs: owner only |
| GET /api/v1/receipts/verify/{leaf} | Check a receipt hash and its anchor. No wallet, no job id |
| GET /api/v1/outputs/{job_id}/{n} | Output file n of a finished job, served from this API |
| POST /api/v1/images/generations | Standard images API shape over the same 402 flow |
| GET /api/v1/policy | Spend cap state for a payer. Read only |
Account and credits
Send Authorization: Bearer with a session token (tgs_) or an API key (tgk_). Routes marked session need a signed-in wallet.
| POST /api/v1/auth/nonce | Sign-in message and nonce for a wallet |
| POST /api/v1/auth/verify | Check the signature, returns a session token |
| DELETE /api/v1/auth/session | Sign out |
| GET /api/v1/account | Balance (available and held), totals, open holds, deposit details |
| DELETE /api/v1/account | Delete your account ({"confirm":"DELETE"}). Session |
| GET /api/v1/account/sample | Free sample status for this wallet |
| POST /api/v1/account/sample | Run your one free sample. Session |
| GET /api/v1/account/ledger | Ledger entries, newest first, 100 per page |
| GET /api/v1/account/ledger.csv | All entries as CSV |
| GET /api/v1/account/invoices/{entry_id} | Invoice for one entry (HTML, or ?format=json) |
| POST /api/v1/account/deposits | Add a USDG transfer as credits. Session |
| GET /api/v1/account/jobs | Jobs paid by this wallet |
| POST /api/v1/account/runs | Run a model paid from credits |
| POST /api/v1/account/refunds | Move a failed x402 payment into credits. Session |
| GET /api/v1/account/withdrawals | Your withdrawal requests |
| POST /api/v1/account/withdrawals | Request a withdrawal. Session |
| DELETE /api/v1/account/withdrawals/{id} | Cancel a pending withdrawal. Session |
| GET /api/v1/account/ssh-keys | Your saved SSH public keys for GPU rentals. Session |
| POST /api/v1/account/ssh-keys | Save an SSH public key (at most 10). Session |
| DELETE /api/v1/account/ssh-keys/{id} | Remove a saved SSH key. Session |
| GET /api/v1/account/keys | Your API keys. Session |
| POST /api/v1/account/keys | Create a key, secret shown once. Session |
| POST /api/v1/account/keys/pause | Pause or resume every key. Session |
| PATCH /api/v1/account/keys/{id} | Rename, change the daily cap, switch off. DELETE revokes. Session |
| GET /api/v1/account/gpu/rentals | Your GPU rentals paid from credits |
| POST /api/v1/account/gpu/rentals | Rent a GPU from credits |
| GET /api/v1/account/gpu/rentals/{id} | State, SSH and Jupyter commands, meter. DELETE stops it |
| POST /api/v1/account/gpu/rentals/{id}/keepalive | Push back the inactivity stop |
Service and discovery
| GET /api/v1/status | Status of each part. Always 200. GET /api/v1/health is the same but answers 503 when not ready |
| GET /api/v1/config | Network, currency and site links |
| GET /api/v1/chain | Current Robinhood Chain block |
| GET /api/v1/live | Liveness. Also /livez, /readyz, /healthz |
| GET /api/v1/milestones | Roadmap phases and their status |
| GET /.well-known/x402 | x402 discovery: network, currency and one resource per model |
| GET /api/v1/openapi.json | The OpenAPI spec. Also /openapi.json |
Owner-only routes
Routes under /api/v1/admin/ need the X-Owner-Token header. They are for the TensorGrid team and are not part of the public API.
Errors
Every error has the same shape. error is a stable code. message is for people. request_id matches the X-Request-Id header.
{
"error": "missing_input",
"message": "A required input for this model is missing. See GET /api/v1/models/{id}.",
"field": "image_url",
"request_id": "req_nSoVx8bx9rct"
}| Status | Meaning |
|---|---|
| 400 | Bad input. The body names the field |
| 401 | Sign in needed, the session expired, or the API key was revoked |
| 402 | Payment needed, the payment is not mined yet (retryable: true), or not enough credits (insufficient_credits) |
| 403 | The spend cap or policy said no, or an API key is off, paused or over its daily cap. Nothing is charged |
| 404 | No such route, model, quote or job |
| 409 | Already used, or another request for the same thing is running |
| 410 | The quote expired. Ask for a new one |
| 429 | Too many requests. Wait Retry-After seconds |
| 503 | Not enabled or not available right now. Nothing was charged |
Limits and retries
- Public reads: 600 / min per client. Paid and write calls: 30 / min per client, and also 30 / min per paying wallet or API key, so a burst spread over many IPs is still limited. A client is one IPv4 address or one IPv6 /48, read from the client address our proxy sees. Shared relay ranges get a higher limit.
- Responses carry
X-RateLimit-Limit(the limit for your client),X-RateLimit-Remaining(counted against that same limit) andX-RateLimit-Reset(seconds until the window ends). Over the limit you get429withRetry-After. 401answers carryWWW-Authenticate: Bearer realm="tensorgrid". Managing API keys, deposits, SSH keys, withdrawals and account deletion need a signed-in wallet session: an API key gets403 session_requiredthere, on purpose. Manage keys in the app; use the key for runs, balance and jobs.- Send an
Idempotency-Keyon paid calls. The same key and request returns the stored answer withIdempotent-Replayed: true. No second charge. Keys are kept for 24 hours. - List routes take
limit(1 to 500) andcursor. Passnext_cursorback for the next page. - Paths under
/api/v1are stable. New fields can appear, so ignore fields you do not know.
CORS
- Browsers on the TensorGrid sites can call every API route. No cookies are used.
- For local development,
http://localhostandhttp://127.0.0.1on any port can call public read routes and routes you call with an API key (Authorization: Bearer tgk_...). - Local origins never get CORS for sign-in routes, owner routes or requests that carry a wallet session token.
https://localhostand look-alike hosts are not allowed.
FAQ
GET /api/v1/jobs/{id}.failed_refund_due and the USDG goes back to the paying wallet. Refunds are made by hand in this version.X-Request-Id of the failing call.