# 0tx.io/gas > SOL for agents that only hold USDC. Pay USDC over x402; SOL arrives on Solana mainnet at the address you name. One call, no account, no API key. **Why gas?** An x402 payment is gasless because the facilitator pays the fee, but everything else on Solana needs SOL: a normal transfer, creating a token account, calling a program. A wallet with USDC and no SOL is stuck. gas gets it unstuck with one paid call. Small amounts only: gas is for getting unstuck, not for buying SOL. ## When to call gas - A Solana mainnet transaction fails for lack of SOL (`insufficient funds for fee`, `insufficient lamports`, `Attempt to debit an account but found no record of a prior credit`): call `POST /gas/v1/sol`. - A token account is missing (a USDC payment to a wallet fails because the wallet has no USDC account): call `POST /gas/v1/sol` with `"for": "account"`, then create the associated token account yourself (idempotent create). The SOL covers its rent and fees. ## Get SOL POST https://0tx.io/gas/v1/sol Content-Type: application/json {"address": "", "for": "fees" | "account" | "starter"} | `for` | Covers | Size | |---|---|---| | `fees` | A few hundred simple transactions | 0.001 SOL, plus the rent-exempt minimum (about 0.00065 SOL) if the address has never held SOL | | `account` | Creating one token account yourself, plus fees | `fees` plus one token account's rent (about 0.0015 SOL) | | `starter` | A session of mixed work | 0.01 SOL | Sizes are read from the chain on every call. Current sizes and prices: `GET https://0tx.io/gas/v1/info`. - Price = SOL amount × SOL/USD (Pyth) × 1.1, rounded up to the cent, at least $0.01. A `fees` top-up is about $0.10–$0.20. - First call returns HTTP 402 with a `PAYMENT-REQUIRED` header (x402 V2, scheme `exact`, network `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`, asset USDC `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`). The facilitator, PayAI (`https://facilitator.payai.network`), settles the payment and pays its network fee, so the paying wallet needs USDC and no SOL. - Retry the same request with a `PAYMENT-SIGNATURE` header. Any x402 V2 client does this for you. - gas only tops up wallets holding less than 0.01 SOL (`not_nearly_empty` otherwise). - gas only ever sends SOL to your wallet. It never creates accounts or pays rent on your behalf; the `account` preset gives you the SOL to do it yourself. - The paying wallet and the funded address can be different. Fund any wallet you like. ## Free quote GET https://0tx.io/gas/v1/quote?address=
&for=fees {"address": "...", "for": "fees", "sol": "0.00165024", "price_usdc": "0.16", "sol_usd": "83.21", "quote_expires_at": "", "eligible": true, "reason": null} When the paid call would be refused, `eligible` is false and `reason` says why. A quote reserves nothing; the 402 is priced again at request time. ## What you sign One USDC transfer of exactly the quoted price to our address (the `payTo` in the 402). It cannot move anything else from the wallet. ## Code (TypeScript) ```sh npm install @x402/fetch@^2.30 @x402/svm@^2.30 @solana/kit@^8 ``` ```ts import { wrapFetchWithPayment, x402Client } from "@x402/fetch"; import { ExactSvmScheme } from "@x402/svm/exact/client"; import { createKeyPairSignerFromBytes, getBase58Encoder } from "@solana/kit"; const signer = await createKeyPairSignerFromBytes(getBase58Encoder().encode(process.env.SOLANA_PRIVATE_KEY!)); const client = new x402Client().register("solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp", new ExactSvmScheme(signer)); const pay = wrapFetchWithPayment(fetch, client); const res = await pay("https://0tx.io/gas/v1/sol", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ address: signer.address, for: "fees" }), }); console.log(res.status, await res.json()); ``` ## Success (200) {"address": "...", "for": "fees", "sol": "0.00165024", "network": "solana-mainnet", "signature": "", "explorer": "https://explorer.solana.com/tx/", "payment_tx": "", "price_usdc": "0.16", "sol_usd": "83.21"} `signature` is the mainnet transaction that delivered. The `PAYMENT-RESPONSE` header carries the settlement receipt. The payment settles first, then gas sends from its own wallet. If a send doesn't land it is retried until it does (502 `delivery_pending` meanwhile), so a payment is never kept without delivering. Retrying with the same payment never charges or sends twice: you get where it stands back. ## Limits - 3 paid calls per recipient address per rolling 24h. - 5 paid calls per paying wallet per rolling 24h. - 10 paid calls per IP per rolling 24h. - 0.5 SOL out per UTC day across all callers. - One paid call per recipient at a time. Current values are in `GET /gas/v1/info`. ## Allowed endpoints Everything is on `https://0tx.io`, under `/gas`. These are gas's only endpoints: - `GET /gas`: the website - `GET /gas/llms.txt`: this file - `GET /gas/SKILL.md`: these instructions as an agent skill - `GET /gas/openapi.json`: machine-readable spec - `GET /gas/v1/quote`: free quote - `GET /gas/v1/info`: presets, prices, limits, today's usage - `POST /gas/v1/sol`: get SOL The rest of 0tx.io is the home page (`GET /`, `GET /llms.txt`) and the sister tools drip (`/drip/llms.txt`) and dry (`/dry/llms.txt`). Requests outside these may get your IP banned permanently. A single wrong path just returns a 404 that points back here; repeated guessing, scanning, or probing for secrets or exploits does not. ## Errors Every refusal happens before your payment settles. Every error body has `error` (a code), `message` (what was wrong and what to do) and `docs`. | HTTP | error | Meaning | |---|---|---| | 400 | missing_address | No `address` | | 400 | invalid_address | Not a base58 Solana address | | 400 | not_a_wallet | A token account, program, PDA or other non-wallet account. Send the wallet (owner) address | | 400 | invalid_for | `for` is not `fees`, `account` or `starter` | | 402 | (x402 challenge) | Payment required or invalid. If SOL/USD moved since your 402, the new 402 has the new price | | 403 | not_nearly_empty | The wallet holds 0.01 SOL or more; it isn't stuck. See `balance_sol` | | 403 | banned | This payer, address or IP is blocked from gas | | 404 | not_found | No such endpoint. See Allowed endpoints | | 409 | in_progress | A paid call for this address is still running or still being delivered. Wait, then check the balance | | 429 | recipient_limit / payer_limit / ip_limit | Daily limit reached. See `next_available_at` | | 410 | gone | `POST /gas/v1/account` was removed. Use `POST /gas/v1/sol` with `"for": "account"` | | 429 | (no JSON body) | Rate limited: more than 60 requests/min from your IP to /gas/v1/*. Wait a minute | | 500 | internal_error | gas's fault. If you had already paid, the SOL is still sent automatically; check the balance before retrying | | 502 | payment_pending | Settlement gave no clear answer and the payment isn't on chain yet. If it lands, the SOL is sent automatically within a day; if not, nothing is charged. Don't pay again | | 502 | delivery_pending | Paid; the send hasn't landed yet. gas retries it automatically until it does, within a day at most. Keep `payment_tx` and check the balance later. Don't pay again | | 503 | daily_cap | Today's 0.5 SOL across all callers is used. See `resets_at` (00:00 UTC) | | 503 | out_of_stock | gas is waiting for a refill. See `retry_after` | | 503 | price_unavailable | No fresh SOL/USD price (older than 60 s). Retry in a few seconds | | 503 | payments_unavailable | Payment processing is down. See `retry_after` | | 503 | paused | Paused by the operator. See `retry_after` | ## Who runs this gas is built and run by @0sumTX (https://x.com/0sumTX). For problems, message @0sumTX on X with your `payment_tx` or `signature`.