Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Protocol Overview

How AMP works under the hood.


AMP is a financial state protocol. Instead of processing a payment per request, it maintains a persistent financial relationship between two parties through an on-chain channel.

Payment flow

  1. Client requests a resourceGET /v1/data with no payment headers
  2. Server returns pricing402 Payment Required with AMP-Pricing, AMP-Recipient, AMP-Program headers
  3. Client opens a channel — one Solana transaction deposits funds into a PDA-owned vault
  4. Client retries with credentialsAMP-Channel, AMP-Seq, AMP-Sig headers
  5. Server validates and serves — verifies channel state, signature, and sequence number. Returns 200 OK
  6. Repeat — steps 4-5 for all subsequent requests. Zero on-chain transactions.
  7. Server settles periodically — one Solana transaction covers all accumulated usage
  8. Client closes channel — remaining balance is refunded

Core concepts

Channels

A persistent financial state object between a funder and recipient, stored as a PDA on Solana. Holds deposited tokens in a vault. Lifecycle: Open, Active, Settled (repeating), Closed.

Metering

Off-chain usage tracking by the server. Modes: per-call, per-second, per-byte, per-compute. No on-chain transactions during consumption.

Settlement

On-chain transfer of owed funds from the vault to the recipient. Always net — one transaction covers all usage since the last settlement.

Delegation

A funder assigns consumption rights to a delegate pubkey. The delegate can consume services against the channel up to a specified limit.

Error codes

CodeDescriptionHTTP Status
AMP_NO_CHANNELNo valid channel for this request402
AMP_UNDERFUNDEDChannel balance below minimum402
AMP_CLOSEDChannel has been closed410
AMP_RATE_EXCEEDEDUsage exceeds channel rate limit429
AMP_INVALID_SEQSequence number not monotonically increasing400
AMP_INVALID_SIGSignature verification failed401
AMP_SETTLE_EARLYSettlement attempted before interval elapsed425
AMP_DEPOSIT_LOWInitial deposit below server minimum400
AMP_INVALID_PROOFMetering proof signature invalid400

Transports

AMP is transport-agnostic. Defined bindings for: