Skip to main content
Key0 Key0 is a TypeScript SDK that turns any API into a paid, agent-accessible service. Drop it into your Express, Hono, Fastify, or MCP server — agents discover your pricing, pay in USDC on Base via the x402 protocol, and get access. No signup walls, no API key portals, no proxying.
npm install @key0ai/key0

How it works in 30 seconds

1

Agent discovers your service

The agent calls GET /discover to browse your pricing plans — plan IDs, USDC amounts, and your wallet address. No payment yet.
2

Agent pays on-chain

The agent signs an EIP-3009 authorization off-chain (no gas required on their side). Key0’s gas wallet executes the USDC transfer on Base.
3

Agent receives access

Subscription plans: Key0 returns a signed JWT (AccessGrant). The agent uses it as a Bearer token to call your protected endpoints.Per-request plans: Key0 returns the API response directly (ResourceResponse) — no token issued, payment settled per call.
Unfamiliar with terms like EIP-3009, x402, AccessGrant, or ChallengeEngine? Read Core Concepts for plain-English definitions before continuing.

Why Key0

AI agents cannot fill out signup forms, enter credit cards, or navigate dashboards to get API keys. They need a machine-native way to discover, pay for, and access services. Key0 solves this by embedding the entire payment-and-access flow directly into your API:
  1. An agent discovers your service and its pricing (via A2A agent card or MCP tool).
  2. It pays on-chain in USDC — one transaction, no intermediary.
  3. It receives a signed JWT and calls your protected endpoints.
No proxy sits between the agent and your API. You keep full control of your infrastructure.

Value props

No Signup Walls

Agents discover your service and pay automatically — no API key portals, no signup forms, no human in the loop.

Open Source & Self-Hostable

Every part of the payment flow is auditable and customizable. Run it as an npm package embedded in your app, or as a standalone Docker container from key0ai/key0 on Docker Hub.

Automatic Refunds

If credential delivery fails after payment, Key0 settles a refund on-chain automatically. No manual intervention required.

Supported agent environments

Key0 works with any agent that can make HTTP requests. It has been tested with:
  • Claude Code — Anthropic’s CLI agent
  • OpenClaw — open-source agent framework
  • Cursor — AI-powered IDE

Protocols

HTTP / REST

Standard x402 payment flow over HTTP. Any HTTP client can participate.

MCP

Model Context Protocol integration. Agents discover plans and pay via MCP tools over Streamable HTTP transport.

A2A

Google’s Agent-to-Agent protocol. A2A task lifecycle with x402 payment metadata built in.

Payment rails

Today: USDC on Base (mainnet and Base Sepolia testnet) via the x402 protocol. On-chain, instant, non-custodial.
Coming soon: Visa, Mastercard, and UPI support — so agents can pay with traditional rails when on-chain is not an option.

Install

npm install @key0ai/key0

Next steps

Quickstart: Embedded

Add Key0 to an existing Express, Hono, or Fastify server in under 5 minutes.

Quickstart: Standalone

Run Key0 as a standalone Docker service that sits alongside your API.

Core Concepts

Plain-English definitions of every Key0 term — read this before diving in.

Paying for Access

For agents and buyers: how to discover, pay, and call a Key0-protected API.