Docs

Buy a credit, redeem it for a key, call the gateway. Everything the site does is an API you can call yourself.

Quickstart

  1. In the marketplace, choose an amount from $1 and pay in USDG on Robinhood Chain. You sign one message; the transfer is broadcast for you, so you need no gas.
  2. In your dashboard, redeem the credit. Your browser builds a zero-knowledge proof and you get an API key.
  3. Point any OpenAI client at Snarket and use that key.
curl https://snarket.ai/v1/chat/completions \
  -H "Authorization: Bearer snk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-oss-120b",
    "max_tokens": 600,
    "messages": [{"role": "user", "content": "Hello"}]
  }'
from openai import OpenAI

client = OpenAI(base_url="https://snarket.ai/v1", api_key="snk_...")
reply = client.chat.completions.create(
    model="gpt-oss-120b",
    max_tokens=600,
    messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)

Streaming works the same way with stream: true. Each call is charged at the item's price per token and taken from the key's balance.

Images

Image items use the images endpoint with the same key, at a fixed price per picture.

curl https://snarket.ai/v1/images/generations \
  -H "Authorization: Bearer snk_..." \
  -H "Content-Type: application/json" \
  -d '{"model": "flux-schnell", "aspect_ratio": "16:9",
       "prompt": "A glass cube on still water"}'

The response holds each picture as base64 in data[].b64_json, with its type in mime_type. There are no image links: Snarket keeps no copy to link to.

For agents

Nothing on Snarket needs a browser or an account, so an agent with a funded wallet can do all of it by itself:

  1. See what is for sale. GET /v1/listings returns every item with its price and the endpoint that serves it.
  2. Buy. POST /v1/credits answers 402 with payment terms. The agent signs one EIP-3009 authorization for USDG and sends it back. It needs no gas.
  3. Redeem. The agent downloads the tree, builds the proof, and posts it to POST /v1/credits/redeem with the hash of a key it made itself.
  4. Use. Every call after that carries the key and nothing else.

An agent that buys and redeems in one go is easy to link by timing. One that cares should buy early, redeem later, and wait for a crowd at its amount: GET /v1/credits reports how many credits of each amount were bought.

API

GET /v1/listings
Every item with its maker, context length and price per 1M tokens.
GET /v1/categories
The marketplace's categories (Models, Media, Search and data, Compute): which are live, which are planned, and how many items each has.
GET /v1/models
The models in OpenAI's list shape, for SDK model pickers.
POST /v1/chat/completions
OpenAI-compatible chat. Needs Authorization: Bearer snk_.... The response carries X-Snarket-Charge-USD and X-Snarket-Receipt-URL.
POST /v1/images/generations
Image items. Body: {model, prompt, n?, aspect_ratio? | size?}, with n from 1 to 4. Returns pictures as base64. Only pictures that were made are charged.
POST /v1/search
Web search. Body: {query, num_results?, model?}, with up to 10 results. model is web-search (the default) or instant-search. Returns results[] with title, url, published, author and snippets.
POST /v1/read
One page as clean text. Body: {url}. Returns {url, title, text}.
POST /v1/answer
A short answer with its sources. Body: {query}. Returns {answer, citations[]}.
GET /v1/key
The balance of the key in the Authorization header and its recent calls: token counts and charges.
GET /v1/credits
The amounts on sale and how many credits of each were bought, the payment chain and asset, the tree's root and size, and where the prover's files are.
POST /v1/credits
Buy a credit. Body: {amount_usd, commitment}. Answers 402 with x402 payment terms; send it again with a PAYMENT-SIGNATURE header to pay.
GET /v1/credits/leaves
Every leaf of the tree in order, with the payment that bought it. Public, so anyone can rebuild the root.
POST /v1/credits/redeem
Redeem a credit. Body: {proof, root, nullifier_hash, amount_usd, key_hash}. Creates a key with that hash, or adds to it.
GET /v1/receipts/{id}
The enclave's signed receipt for a served call: hashes and timestamps, never content.
GET /v1/attestation
The enclave's attestation report, which publishes the key that signs receipts.

Errors use OpenAI's shape: {"error": {"message", "type", "code"}}. A call the balance cannot cover answers 402 with code insufficient_balance.

How credits work

A credit is two random numbers you keep, a nullifier and a secret. Snarket never sees them.

  1. Purchase. You send commitment = Poseidon(nullifier, secret) with an x402 payment. Snarket appends leaf = Poseidon(commitment, amount) to a public Merkle tree, using the amount it was actually paid.
  2. Prove. Later you make an API key on your own machine and download the whole tree. You prove, with a Groth16 zk-SNARK, that you know the nullifier and secret of one leaf under the tree's root, paid a given amount. The proof is bound to the hash of your key.
  3. Redeem. You send the proof and the key's hash. Snarket checks the proof, records Poseidon(nullifier) so the credit cannot be redeemed twice, and funds a key with that hash.

The circuit is a Poseidon Merkle tree of depth 20 over BN254. It is the same circuit, with the same proving and verifying keys, that OffRouter uses for private payments.

Privacy

The privacy page walks through the whole scheme and who sees what. In short:

What the proof hides

Which purchase funded a key. Among all credits bought for the same amount, a redeem could be any of them. That number is the crowd you hide in. The marketplace shows it before you buy and the dashboard before you redeem.

The amount itself is public in a proof. An amount few people pick has a small crowd, so the offered amounts hide better than one you type in.

What it does not hide

  • The purchase. Your wallet, the amount and the time are public on Robinhood Chain.
  • Timing. Redeeming seconds after paying, or when you are the only buyer of that amount, points at you.
  • Your IP address when you redeem and when you call the gateway.

Inference

Every model is served by confidential inference, inside an Intel TDX and NVIDIA confidential GPU enclave. Snarket's gateway forwards your request to it and stores the model, the token counts and the charge. It does not store or log prompts or answers.

Image items are different. A standard cloud provider makes the picture, outside any enclave, and sees the prompt. It never sees your key, wallet or address. Snarket returns the picture as data and keeps no copy.

Search and web data items work the same way as image items: a standard cloud supplier sees the query or the address, and never who sent it. Snarket stores a count and the charge, not the query or the results.

Limits

  • A credit is issued by Snarket and redeemable only here. It is not a balance with any model developer.
  • Credits and key balances are not refundable and not transferable.
  • Credits and keys live in your browser. Snarket holds no copy and cannot recover one you lose.
  • A call that omits max_tokens is capped at 8192 output tokens, or at what the balance covers if that is less.