The Open Anonymity Project, in collaboration with the Ethereum Foundation, has launched zkAPI, a groundbreaking system designed to enable metered API access without compromising user identity. This innovative solution leverages zero-knowledge proofs to decouple payment from the user’s personal identification, allowing individuals and organizations to utilize API services anonymously. zkAPI is now operational on the Ethereum Mainnet, marking a significant step forward in privacy-preserving digital services.
The Persistent Challenge of Identity in API Usage
In the current digital landscape, virtually every interaction with an Application Programming Interface (API) is tied to an identity. API keys act as digital passports, linking usage to specific accounts, which are in turn connected to payment methods. This creates a comprehensive and often permanent record of an individual’s or entity’s engagement with a service. For providers, this offers valuable insights into user behavior, enabling them to build detailed profiles of their clientele over extended periods.
This pervasive linkage of identity to API calls presents a significant privacy concern, particularly for services that handle sensitive user queries. When individuals engage with Artificial Intelligence (AI) models, for instance, they often seek information related to personal health, financial matters, or express private doubts and concerns. Under the prevailing model, utilizing such AI services means furnishing a continuous log of one’s innermost thoughts and inquiries to the entity managing the billing relationship.
Historically, the alternatives to this pervasive identity tracking have been inadequate. On-chain payments, while offering a degree of transparency, are often slow, prohibitively expensive, and expose transaction details to public scrutiny. The alternative has been to place a significant degree of trust in intermediaries, hoping they will refrain from analyzing or exploiting the sensitive data being transmitted. This reliance on trust is a precarious position for users seeking genuine privacy.
The zkAPI Solution: Decoupling Payment from Identity
zkAPI fundamentally rethinks this paradigm by architecting a system where payment is entirely divorced from identity. The core mechanism involves users depositing credits – such as Ether (ETH) or USDC – into a smart contract vault on the Ethereum blockchain. This initial deposit is a standard, one-time transaction. Following this, the user’s balance transforms into a private "note," akin to digital cash, that is spendable only by the owner and cannot be traced back to its origin.
To authorize the use of an API, the user’s client software generates a concise zero-knowledge proof. This proof mathematically attests to the existence of a funded note that covers the requested expenditure, crucially without revealing which specific note is being used or who owns it. Furthermore, it ensures that the balance has not been spent previously. A single proof can authenticate a single API request or an entire session of interactions, streamlining the process and enhancing efficiency.
The API provider receives these proofs and can independently verify their validity. They can confirm that a legitimate payment source exists and that the requested usage is within the bounds of the deposited credits. However, they are entirely unable to ascertain the identity of the user, the specific deposit that funded the note, or even link multiple requests from the same user. This separation ensures that the provider sees the requests and the payment layer sees the spend, but neither entity gains knowledge of the crucial link between them.
Two key cryptographic principles underpin the security and privacy of zkAPI. Firstly, user deposits are registered as commitments within a Merkle tree. This structure allows a zero-knowledge proof to assert membership within the set of valid deposits without pointing to any specific one. Secondly, every expenditure is accompanied by the generation of a "nullifier." This is a unique, one-way derived identifier generated from the secret of the note being spent. Users who operate within their allocated balance remain unlinkable. However, any attempt to spend the same balance twice will result in the generation of a duplicate nullifier, which immediately flags the malicious activity without revealing any other user data.
The Technical Architecture: How zkAPI Operates
The operational flow of zkAPI can be understood by examining its payment and conversation paths, which are unified by two critical elements: a short-lived key and a usage receipt.
The process begins with the user depositing funds into a vault contract on Ethereum. This action establishes their available credit. When a user wishes to interact with an API, their client generates a short-lived cryptographic key. This key is used to sign and authorize requests. Simultaneously, a zero-knowledge proof is generated, confirming that the user possesses a valid, unfunded note and that this note has sufficient balance for the intended usage.
The zkAPI server receives the signed request and the accompanying zero-knowledge proof. It verifies the proof and, if valid, forwards the request to the actual API provider. The API provider processes the request and returns the output. Crucially, the API provider only sees the content of the request and its response; it has no access to the user’s identity or the payment details.
Upon the expiration of the short-lived key, or at the conclusion of a session, the zkAPI server generates a signed receipt. This receipt quantifies the total usage incurred during the session, effectively acting as a bill. This signed receipt is then presented to the payment layer, where the corresponding amount is deducted from the user’s note. This process ensures that the provider cannot retroactively alter the bill, and a single authorization token can cover an entire session of interactions, rather than requiring a new proof for each individual call.

zkAPI also offers a simpler "proxy mode." In this configuration, the zkAPI server acts as a direct relay for requests to the API provider. While easier to implement and manage, this mode does allow the zkAPI server to see the traffic passing through it. The "runtime-key mode," described above, is designed specifically to prevent any payment intermediary, including the zkAPI server itself, from ever viewing the actual content of the user’s requests.
The cryptographic underpinnings of zkAPI are robust. Spend proofs are generated using the Groth16 zk-SNARKs system on the BN254 elliptic curve, a standard for efficient zero-knowledge proofs. Commitment and nullifier hashes are computed using the Poseidon hash function, and notes are organized within a 32-level deep Merkle tree. Off-chain verification of spend proofs by the zkAPI server ensures rapid processing. On-chain, the vault contract verifies proofs during deposit, closure, and withdrawal operations, ensuring that users can exit the system with their remaining funds, irrespective of the server’s operational status or honesty.
Practical Implications and Use Cases
The practical implications of zkAPI are far-reaching, particularly in scenarios where user privacy is paramount. The system elegantly separates the concerns of content provision from payment processing. The zkAPI server is privy to the fact that a valid payment exists and the total value consumed per session, but it remains oblivious to the user’s identity, the nature of their queries, or the specific deposit that funded their activity. Conversely, the AI provider, which processes the actual prompts and generates responses, has no visibility into who is paying for these services.
The public Ethereum blockchain records deposits, closures, and withdrawals, providing an auditable ledger of financial activity within the zkAPI system. However, it offers no insight into what specific services or data were exchanged for these funds.
The potential applications for zkAPI extend beyond AI services, encompassing any scenario that involves metered usage and requires a degree of payment privacy. These include:
- AI Chatbots and Agents: Hiding which specific note paid for model calls and any link between sessions.
- Blockchain RPC Services: Masking which funding source paid for queries.
- Image and Video Generation: Concealing the identity of those who paid for specific generation jobs.
- VPNs and Bandwidth Providers: Obscuring who paid for connection time and data usage.
- Machine-to-Machine Services: Enabling agents to pay for per-task spend without requiring traditional accounts.
While zkAPI effectively anonymizes the payment layer, it’s important to note that it does not inherently provide network-level anonymity. The API gateway might still infer user activity based on stable IP addresses and request patterns. For enhanced network privacy, users can route their zkAPI traffic through anonymity networks like Tor, initiating a fresh circuit for each new session.
Content privacy also remains a consideration. If users consistently include personal details, adopt a recognizable writing style, reuse extensive conversation histories, or reference specific project documents across different sessions, the inference provider may still be able to re-identify them. This highlights a fundamental trade-off: highly private standalone queries may be less useful due to the lack of contextual memory. Emerging solutions like confidential GPU computing and the use of local or Trusted Execution Environment (TEE) models are being explored to address these content-level privacy concerns, as detailed in Open Anonymity’s blog post on "Unlinkable Inference."
For service providers, integration with zkAPI involves a shift in their payment infrastructure. Instead of managing user accounts and API keys, they will need to accept zero-knowledge proofs and settle signed usage receipts. This transition is designed to be minimally disruptive, with existing pricing models, rate limits, and infrastructure remaining largely unchanged.
Limitations and Future Directions
Despite its significant advancements, zkAPI acknowledges certain limitations. The primary challenge lies in the absence of inherent network anonymity. As mentioned, a user’s IP address can potentially reveal their identity if requests are consistently made from the same network. This is a known issue within the privacy-preserving technology space, and solutions like Tor are recommended for users seeking a higher degree of network obfuscation.
The second limitation pertains to privacy leakage through prompt content. While zkAPI ensures that the payment for these prompts is private, the content itself can still be a fingerprint. If a user repeatedly asks the same questions, uses similar phrasing, or includes unique identifiers within their prompts, it becomes possible for the inference provider to correlate these interactions and potentially re-identify the user. This is a complex problem with no easy solution, as the utility of AI often relies on context and memory, which can inadvertently create identifiers. The Open Anonymity project is actively investigating methods to mitigate this, including the exploration of local or TEE-based models that can process requests using shared memory rather than requiring users to manually input identifying details.
Background and Broader Impact
zkAPI is the practical realization of the "ZK API usage credits" concept, a design first articulated on Ethereum Research by Davide Crapis and Vitalik Buterin. This theoretical framework laid the groundwork for a system that could facilitate private, metered API access. The Open Anonymity team has been instrumental in translating this design into a functional system, developing the client, server, and smart contracts that are now available for public use.
The launch of zkAPI on Ethereum Mainnet represents a crucial milestone in the evolution of digital privacy. It provides a tangible solution for users who value their personal data and wish to engage with online services without leaving a traceable financial footprint. By decoupling payment from identity, zkAPI empowers individuals and organizations to leverage the power of modern APIs, including advanced AI models, with unprecedented levels of privacy.
The implications for various industries are substantial. Service providers can attract users who are concerned about data privacy, potentially expanding their customer base. Developers can build applications that offer a more secure and private user experience. As the digital landscape continues to evolve, with increasing concerns about data surveillance and the monetization of personal information, technologies like zkAPI are poised to play a pivotal role in shaping a more privacy-respecting future for online interactions. The ability to pay for services anonymously not only protects individual users but also fosters innovation in areas where sensitive data is a prerequisite for progress.















