x402 pay-per-use

Store an artifact for a cent. No account.

An agent with a USDC wallet pays per request with the x402 protocol. The same REST API, the same URLs, no sign-up and no API key: the wallet that pays is the account.

LivePay-per-use is live on Base. Any x402 client can pay.

Prices

Pay for the request you make.

OperationPriceBuys
Read: list, get, download$0.005One request
Search$0.01One request
Upload up to 10 MiB$0.0130 days of storage
Upload up to 100 MiB$0.0530 days of storage
Upload up to 1 GiB$0.5030 days of storage
New versionThe upload band of its sizeAt least 30 days from that upload
ExtendThe band of everything the artifact holds30 more days
Complete an upload, deleteFreeA wallet signature, no payment

Paid in USDC on Base and settled by Coinbase's facilitator. Files larger than 1 GiB are not sold per use. Already have an API key? Nothing changes: a request with an Authorization header never asks for payment.

The protocol

Two requests: one to see the price, one to pay it.

x402 version 2, scheme exact. A request without payment gets 402 and a PAYMENT-REQUIRED header naming the price. The same request with a signed PAYMENT-SIGNATURE runs, and the response carries PAYMENT-RESPONSE. All three headers are base64 JSON.

$ curl -i https://api.artefaktum.dev/v1/projects
HTTP/2 402
payment-required: eyJ4NDAyVmVyc2lvbiI6Miwi…
cache-control: no-store

# decoded: {"x402Version": 2, "accepts": [{"scheme": "exact",
#   "network": "eip155:8453", "amount": "5000", "asset": "0x8335…2913", …}]}

$ curl -i https://api.artefaktum.dev/v1/projects \
    -H "PAYMENT-SIGNATURE: eyJ4NDAyVmVyc2lvbiI6Miwi…"
HTTP/2 200
payment-response: eyJzdWNjZXNzIjp0cnVlLCJ0…

{"items": [{"id": "0199…", "name": "default", …}]}

Official client

Any x402 client does the retry for you.

With the official TypeScript packages @x402/fetch and @x402/evm, a paid call is an ordinary fetch.

import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";

const wallet = privateKeyToAccount(process.env.WALLET_KEY);
const pay = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(wallet) }],
});
const res = await pay("https://api.artefaktum.dev/v1/projects"); // $0.005

Storage

What 30 days means.

An upload buys 30 days

The artifact expires at the end of them and is removed, unless you extend it first.

POST /v1/artifacts/{id}/extend buys 30 more days at the band of everything the artifact holds. For a small artifact that is the same cent again.

A new version is priced by its own size and restarts the clock: the artifact then lasts at least 30 days from that upload. Time already bought is never shortened.

Free with a signature

Completing an upload and deleting your own artifact cost nothing. They use the x402 sign-in-with-x extension: the wallet signs a one-time challenge to prove it owns the artifact, and no funds move.

The terms and the refund policy cover pay-per-use.

Get started

Three steps.

  1. Fund a wallet with USDC on Base.
  2. Wrap fetch with the official client, as above.
  3. Call https://api.artefaktum.dev/v1/projects. The first payment creates your tenant with a default project.

Rather pay by the month? Plans start free, with an API key from the console.