Docs

Spare's gateway speaks OpenAI's API. Any client that lets you set a base URL works.

1. Get a key

Open the app, connect a Solana wallet and make a key under Keys and usage. You sign a message; nothing is sent on chain. The key spends the API balance of that wallet. Only a hash of it is stored, so copy it when it is shown.

2. Fund the balance

Buy CREDIT on the book with "straight to my API balance", or activate CREDIT you already hold. Either way the program burns it and emits an event naming the wallet; the gateway credits that wallet within seconds. Activations nobody reported are picked up by a sweep of the program's history.

3. Call it


  
Base URL/api/v1
AuthAuthorization: Bearer sk-cred-…
POST /chat/completionsStreaming, tools, vision, JSON mode: whatever the model supports upstream.
POST /completions, /embeddings, /responsesRelayed the same way.
GET /modelsThe upstream's catalogue with prices. Public.
Model namesProvider-prefixed ids, such as openai/gpt-oss-120b or anthropic/claude-sonnet-4.5.

Billing

Each request costs exactly what the upstream (Vercel AI Gateway) reports for it, in dollars of balance, read from the usage on every response. Requests route only to zero-data-retention endpoints; a model without one returns the upstream's error rather than falling back.

401Missing or unknown key.
402The balance is empty. Activate CREDIT.
x-gateway-overhead-msMilliseconds the gateway spent before forwarding, on every response.

A request in flight when the balance runs out still completes and is billed, so a balance can go a few cents below zero. The next request is refused until it is topped up.

Usage

GET /api/account with your key returns the balance, your last 500 requests (model, tokens, cost, timing; never the prompt) and daily totals. GET /api/account?wallet=… returns any wallet's balance.

Use it from Claude Code, Cursor and other MCP clients

Spare is a remote MCP server. Add it with your key and the client gets these tools: chat (any model, billed to your balance), list_models, balance, web_fetch, solana_account and solana_balances.


  

Cursor, Windsurf and others take the same URL and header in their MCP settings.

Paid tools

The same key and balance pay for tools an agent needs beside a model. Each has a flat price, charged only when it succeeds.

POST /api/tools/web_fetch {url}A web page as readable text. $0.001. Internal and private addresses are refused.
POST /api/tools/solana_account {address}One Solana account, parsed. $0.0003.
POST /api/tools/solana_balances {address}A wallet's SOL and every token it holds. $0.0005.
GET /api/toolsThe list, with schemas and prices. Public.

Activating from code

Agents can top themselves up with no page in the way: build the program's activate instruction (tag 8, amount, beneficiary), send it, then POST /api/credit with the signature. The client in the repository (client/credit.js) builds every instruction.



  

The program

Unaudited. The admin can change the treasury, the gateway wallet and the platform fee (at most 10%). It cannot move the bank's USDC, mint CREDIT, or touch stakes, orders or agents.