tl;dr: zkAPI allows you to pay for a metered API with out being identified. Deposit credit into an Ethereum vault as soon as, then authorize bounded utilization with zero-knowledge proofs as an alternative of an identification. The supplier sees the requests, and the cost layer sees the spend. Neither learns the hyperlink between them.
The Open Anonymity Mission constructed it with the Ethereum Basis, and it runs on Ethereum Mainnet immediately.
The issue
Each AI API name immediately carries an identification. Your API key factors to an account, the account to a cost methodology, and each immediate you ship joins the report hooked up to each. The supplier can join years of your utilization right into a single profile.
Prompts are private. Folks ask AI fashions about their well being, their funds, their doubts. Below the present mannequin, utilizing AI means handing a operating transcript of your considering to whoever holds the billing relationship. The alternate options have been poor: pay per request onchain, which is gradual, costly, and traceable by anybody, or belief a intermediary to not look.
The thought
zkAPI separates cost from identification. You deposit credit (ETH, USDC, and so forth.) right into a vault contract on Ethereum, one unusual transaction. From then on, your steadiness exists as a personal notice: digital money that solely you’ll be able to spend and that no person can hint again to the deposit.
To authorize spending, software program in your machine produces a small zero-knowledge proof that claims, in impact, {that a} funded notice covers this spend and no person has spent it earlier than. One proof can cowl a single request or a complete session. The server can examine that the assertion is true with out studying which notice, which deposit, or which particular person. On the cost layer, requests don’t hyperlink to you, and they don’t hyperlink to one another.
Two items of cryptography make this protected in addition to personal. Deposits reside as commitments in a Merkle tree, so a proof can present “my notice is without doubt one of the legitimate ones” with out pointing at any specific one. Each spend publishes a nullifier, a one-way serial quantity derived from the notice’s secret. A person who stays inside their steadiness stays unlinkable. A person who tries to spend the identical steadiness twice produces a reproduction nullifier, which exposes the try and nothing else.
The way it works

The cost path (steps 1 to three) and the dialog path (step 4) share two objects: the short-lived key and its utilization receipt.
The server that handles cash by no means sees content material, and the supplier that sees content material by no means learns the billing identification behind a key.
- Your app talks to a small consumer operating by yourself gadget. Nothing concerning the app modifications. It speaks the identical API it at all times did.
- The consumer sends the zkAPI server a proof of cost, with no immediate and no identification hooked up.
- The server checks the proof and mints a recent API key on the spot, short-lived and capped in {dollars}. The important thing exists solely in your gadget’s reminiscence.
- Your prompts go straight out of your gadget to the AI supplier with that key. When the important thing expires, the server fees your personal steadiness for the metered utilization slightly than the reserved cap.
The spending cap works as a reservation. When the important thing expires, the supplier facet information the important thing’s whole utilization in a signed receipt, and the server deducts that quantity out of your notice. Neither facet can rewrite the invoice afterward, and one authorization covers a complete session of requests slightly than one proof per name.
zkAPI additionally ships an easier proxy mode, the place the zkAPI server relays requests to the supplier itself. It’s simpler to function, however the relay sees visitors. The runtime-key mode above exists in order that no cost middleman ever does.
zkAPI proves spends with Groth16 on the BN254 curve, hashes commitments and nullifiers with Poseidon, and retains notes in a Merkle tree 32 ranges deep. The server verifies spend proofs off-chain. The vault contract verifies the identical form of proof at deposit, shut, and escape, so your exit by no means depends upon the server’s honesty.
In follow
| Social gathering | Learns | By no means learns |
|---|---|---|
| zkAPI server | a legitimate cost exists, and whole {dollars} per session | who you might be, what you requested, which deposit paid |
| AI supplier | prompts and responses, because it runs the mannequin | who’s paying |
| Ethereum (public) | deposits, closes, withdrawals | what any steadiness paid for |
-
Your funds keep yours: The vault is a contract on Ethereum slightly than an organization account: you’ll be able to shut your steadiness and withdraw onchain, even when each zkAPI server disappears.
-
Your instruments keep the identical: The consumer exposes the usual OpenAI and Ollama APIs by yourself machine. Current apps, editors, and chat purchasers work by pointing them at localhost.
Use instances
AI inference comes first as a result of prompts are delicate and the billing path ties each to you. The identical consumer and contracts can entrance any service that fees per use:
| Use case | Metered unit | What the cost layer hides |
|---|---|---|
| AI chat and brokers | mannequin calls | which notice paid, and any billing hyperlink between periods |
| Blockchain RPC | queries | which funding supply paid for the queries |
| Picture and video technology | jobs | who paid for which jobs |
| VPNs and bandwidth | time and information | who paid for the connection |
| Machine-to-machine providers | per-task spend | brokers pay with out an account |
zkAPI hides the cost hyperlink. A supplier nonetheless sees what a request accommodates and community metadata reminiscent of your IP tackle, and it could possibly attempt to correlate periods by timing. Community anonymity and content material privateness are separate layers: a VPN or Tor handles the community facet, and confidential GPU computing is rising for content material.
For suppliers, integrating means accepting a proof as an alternative of an API key and settling signed utilization receipts as an alternative of sustaining accounts. Pricing, price limits, and infrastructure keep as they’re.
Limitations
zkAPI’s protections have two limitations: the shortage of community anonymity, and privateness leakage by way of immediate contents.
On the community facet, the principle concern is that the gateway can doubtlessly correlate request patterns from a person in the event that they ship requests to zkAPI underneath a secure person IP tackle. Customers looking for stronger privateness could route requests by Tor and use a recent circuit for every session.
On the content material facet, particular person periods could also be re-linked by the inference supplier if the identical private particulars, writing type, reused dialog historical past, or challenge paperwork are introduced. Shared immediate contents can act as fingerprints for anybody who can learn the prompts. It is a privacy-utility tradeoff: standalone queries are extra personal however much less helpful since previous context is lacking. One mitigation is to leverage native or TEE fashions to generate requests on high of shared reminiscence as an alternative of the person manually writing them. See additionally discussions within the Open Anonymity challenge submit.
Background and hyperlinks
zkAPI is the working implementation of ZK API utilization credit, a design revealed on Ethereum Analysis by Davide Crapis and Vitalik Buterin.
The Open Anonymity group helped flip that design into the consumer, the server, and the contracts you’ll be able to run immediately.
zkAPI is reside on Ethereum mainnet immediately. Attempt it:
Or construct the native gateway and level any OpenAI-compatible app at it utilizing the docs.