---
name: pzero
description: >-
  Buy AI inference — text, image, and video — with USDC on Base, with no human in the loop:
  one signed payment creates the account and returns an API key.
  Use when an agent needs to pay for its own inference, fund or top up a PZERO balance,
  or when a PZERO call answers 402 or 503.
---

# PZERO

An OpenAI-compatible inference API on a two-sided marketplace. You hold prepaid USDC credit and spend it with a Bearer key; sellers post discounted capacity and the cheapest eligible offer wins each call. Inference is never charged per request over x402 — you fund a balance first.

Base URL is `https://api.pzero.studio/v1`. Nothing about the host is derived or configurable.

## Getting a key with no human

`POST https://api.pzero.studio/v1/x402/signup` needs no credential. It answers `402` with x402 payment requirements; sign them (`exact` scheme, EIP-3009, Base mainnet USDC) and retry with the `X-PAYMENT` header and a byte-identical body. The `200` carries a plaintext `pzero_…` key.

The settled payment is the credential: the account belongs to the wallet that paid, and there is no `walletAddress` field to send. The payer needs USDC and nothing else — no ETH, because the facilitator submits the transaction.

Store the key before you do anything else with the response. A key exists in plaintext once, replaying the same payment returns `200 idempotent` with no key, and minting another needs a key you already hold.

Then call inference with the key:

```bash
curl -sS -X POST "https://api.pzero.studio/v1/chat/completions" \
  -H "Authorization: Bearer pzero_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"<a status:live id from /v1/models>","messages":[{"role":"user","content":"Hello"}]}'
```

## The six facts that prevent almost every failure

1. Only `confirmedUsdc` funds inference. New credit lands pending and needs on-chain confirmations — poll `GET /v1/agent/me` until it clears, typically about a minute.
2. A new account's price ceiling is 49¢ per $1 of credit face value, which is often below where supply is posted. Your first call can be refused while your balance is fine. The refusal names the number it needs; `PATCH /v1/agent/max-price` sets it. Raising the ceiling does not raise what you pay — you still clear at the cheapest eligible offer.
3. A refusal is one of three unrelated things, and they have opposite fixes. Too little balance is `402`. A ceiling below the market is `503 no_eligible_supply`. A pool too thin for a job this size is `503 insufficient_routable_at_price`, and no amount of money or ceiling fixes it — send a smaller job or retry later.
4. Images come back as base64 in `images[]`, not as a URL, and are watermarked unless you send `hide_watermark: true`, which costs the same.
5. Video is asynchronous and priced per job at quote time. Quote before queueing, branch on the response `Content-Type` rather than the status code, and stop polling if a JSON body reports `status: COMPLETED` — that means the render finished without media and will be refunded.
6. On the funding routes, `402` means the payment has not landed and always carries `accepts`. `409` means it did land and the request still did not finish: the body carries `transaction`, `reconciling` says whether it will be credited automatically, and paying again would spend twice either way.

## Read next

Everything above is the shape. These carry the detail, and all four are fetchable without a credential.

| Document | Answers |
| --- | --- |
| `https://api.pzero.studio/llms.txt` | How. Every route, the full payment loop with working code, the video and image loops, error codes. |
| `https://api.pzero.studio/pricing.md` | Why a charge is what it is, and which endpoint carries the live number. |
| `https://api.pzero.studio/marketplace.md` | Why a request is refused: cheapest-first routing, and price versus depth. |
| `https://api.pzero.studio/openapi.json` | Request and response schemas, for generated clients. |

Live numbers are never in these files. Rates and model availability are on `GET /v1/models`, spendable supply is on `GET /v1/capacity`, and a specific video price only exists on `POST /v1/video/quote`.
