Introducing zkAPI: private usage credits for any API

zkAPI uses Ethereum vaults and zero‑knowledge proofs to let users pay for metered APIs privately, keeping payment and request data unlinkable.

Introducing zkAPI: private usage credits for any API

Introducing zkAPI: Private Usage Credits for Any API

In the age of AI‑driven services, every request you make to an API is tied to an identity. Your API key links to a billing account, and the provider can stitch together a long‑term profile of your usage. zkAPI solves this problem by separating payment from identity, allowing you to pay for metered API calls on Ethereum while keeping your usage private.

The Problem: Identity‑Linked Billing

When you call an AI model, the request carries an API key that points to a specific account. That account is linked to a payment method, and the provider logs every prompt and response. Over time, the provider can build a detailed profile of your thoughts, health concerns, financial questions, and more. Existing alternatives—paying on‑chain per request or trusting a third‑party intermediary—are either slow, expensive, or still expose your identity.

zkAPI’s Core Idea: Private Credits and Zero‑Knowledge Proofs

  1. Deposit Credits Once – You transfer ETH, USDC, or another token into a vault contract on Ethereum. The deposit becomes a note—a piece of digital cash that only you can spend.
  2. Authorize Spending with a Proof – Your local client generates a zero‑knowledge proof (ZKP) that a funded note covers the requested spend, without revealing which note or who owns it. The proof can cover a single request or an entire session.
  3. Server‑Side Key Minting – The zkAPI server verifies the proof and mints a short‑lived API key on the spot. The key is stored only in your device’s memory, never sent to the provider.
  4. Provider Interaction – Your prompts go directly from your device to the AI provider using the freshly minted key. When the key expires, the provider records the total usage in a signed receipt, and the zkAPI server deducts the amount from your private balance.

This flow keeps the payment layer and the content layer separate: the provider sees the request content but not the payer, and the payment layer sees the spend but not the request details.

Technical Foundations

  • Merkle Tree Commitments – Deposits are stored as commitments in a 32‑level Merkle tree. A proof can prove membership in the tree without pointing to a specific leaf.
  • Nullifiers – Each spend publishes a one‑way serial number derived from the note’s secret. Duplicate nullifiers reveal double‑spending attempts but nothing else.
  • Cryptographic Stack – zkAPI uses Groth16 on the BN254 curve, Poseidon hashing for commitments and nullifiers, and off‑chain verification of spend proofs. The vault contract verifies proofs for deposits, closures, and withdrawals, ensuring your exit is independent of the server’s honesty.

Use Cases Beyond AI

While AI inference is the primary motivation, zkAPI’s model applies to any metered service:

  • Blockchain RPC queries – Pay for each query without revealing the source.
  • Image/video generation – Keep the creative process private while paying per job.
  • VPN or bandwidth – Pay for data usage without exposing your browsing habits.
  • Machine‑to‑machine services – Enable autonomous agents to pay per task without an account.

Limitations and Privacy Trade‑offs

  • Network Anonymity – The gateway can still correlate request patterns if you use a stable IP address. Using Tor or a VPN mitigates this.
  • Prompt Leakage – The provider can link sessions if you reuse personal details or writing style. Local or TEE models can help keep prompts private.

Despite these trade‑offs, zkAPI offers a practical balance between privacy, usability, and existing infrastructure.

Getting Started

  • GitHub – Clone the local client, server, and browser SDK.
  • Vault – Interact with the zkAPI Vault on Ethereum Mainnet (USDC credits).
  • Testnet – Deploy the Sepolia test version with test funds.
  • Browser Chat – Try the OA Chat for a private AI conversation in the browser.

To integrate, simply replace your API key with the zkAPI client on your local machine. Existing OpenAI‑compatible apps will work unchanged.

Conclusion

zkAPI demonstrates how zero‑knowledge proofs can decouple payment from identity, giving users control over their privacy without sacrificing the convenience of metered APIs. By leveraging Ethereum’s smart contracts and robust cryptography, it provides a secure, private, and future‑proof billing model for the growing ecosystem of AI and beyond.

---

TL;DR: zkAPI lets you pay for metered APIs on Ethereum with private credits and zero‑knowledge proofs, separating payment from identity so providers see your requests but not who paid for them.

Source

Read original source

Why we picked this

Ethereum Foundation blog introducing zkAPI, a significant privacy-focused protocol feature.

← Back to all articles