Introducing a new way to review your PRs.

Read the announcement

solana-foundation / pay

CLI for Agentic payments (x402, MPP, AP2).

View on GitHub

30 documents · Updated Nov 11, 2026

docs / payment-cli

Payment CLI

The Payment CLI is the pay Rust application for using stablecoin payments from a terminal or an agent tool. It gives users one command surface for payer accounts, paid HTTP requests, agent launches, provider discovery, payment gateways, batch payouts, subscriptions, local inference, selling inference, and browser-linked wallet onboarding. The CLI prepares shared context, then hands payment work to the Rust payment runtime or starts a runtime-backed service. See Rust payment runtime for the shared payment layer.

Command surface

Request and agent commands

Request commands make existing HTTP and agent tools usable with servers that answer with 402 Payment Required. They preserve the normal tool experience while allowing the payment runtime to inspect a challenge, sign a payment, retry the request, and return the final response.

Command groupPurpose
pay curl, pay wget, pay http, pay fetchMake paid HTTP requests. The first three wrap the matching system tool. fetch uses the built-in HTTP client.
pay claude, pay codex, pay goose, pay qoderLaunch supported agent CLIs with Pay MCP and optional alternate inference routing.
pay acpLaunch a Goose, Claude, or Codex Agent Client Protocol harness with a selected provider and model.
pay mcpRun the MCP server used by clients such as Claude Code and Cursor.

The agent launchers keep the child process focused on its normal protocol. Pay supplies the MCP connection and, when needed, a local payer proxy that handles payment challenges before the child sees the response. pay acp can select a provider and model from flags or PAY_ACP_PROVIDER and PAY_ACP_MODEL; headless routing requires a model. A Buzz-managed ACP launch keeps Buzz credentials in the parent process. The child receives a short-lived relay token that can publish only the reply for its active conversation. See CLI payment operations for request and payer-proxy flows.

References: rust/…/mod.rs• L47-134 rust/…/acp.rs• L19-207 rust/…/acp_middleware.rs• L10-65 rust/…/acp_buzz_relay.rs• L148-229

Account and payment commands

Account commands establish the payer identity that signs transactions. Payment commands use that identity to inspect funds, add funds, transfer stablecoins, send a CSV payout to many recipients, and manage recurring payment rights.

Command groupPurpose
pay setupGuide first-time account creation, secure storage, funding, and client integration setup. It can also redeem an activation code or refresh integrations without replacing an account.
pay accountCreate, import, list, select, export, or remove named accounts. Accounts can use local secure storage, a remote signer, or a browser-linked wallet.
pay connect-onboardHidden preview command for linking the terminal to pay-connect through a browser. Normal users select the same flow with pay setup.
pay whoamiShow the system user, the selected Pay account, and its visible stablecoin balances.
pay topupStart an interactive funding flow for a mainnet or sandbox account.
pay sendTransfer a stablecoin to a public key or named account. It supports automatic currency choice, full-balance sends, memo metadata, fee handling, and confidential transfers when the asset supports them.
pay fanoutValidate and execute a journaled CSV payout to many recipients with bounded concurrency.
pay subscriptionsList, activate, inspect, cancel, and refresh locally tracked MPP subscription delegations.

The account name and network determine which signing identity is used. A command can select an account explicitly, while setup and account management also provide the paths needed to recover from a missing or incomplete identity. Account listing groups accounts by network, marks the active account, and fetches balances in batches for the correct RPC endpoint; an unavailable balance lookup is shown as an offline state with an explorer link rather than as zero. Direct sends resolve a literal public key before a named account, choose a held stablecoin when no currency is given, and use an interactive choice only when more than one balance can cover the amount. New and imported keys are placed in the selected secure store, while remote accounts keep provider credentials in the platform secret store and sign through the provider. The browser-linked cloud flow verifies the returned wallet before it saves any local account state. Subscription commands use the locally tracked subscription ID to find the account and network that own a delegation. Cancellation can settle directly on-chain or use a payment gateway when the subscriber wallet lacks enough SOL for fees. See CLI account management and CLI payment operations.

References: rust/…/mod.rs• L70-128 rust/…/list.rs• L18-107 rust/…/account.rs• L19-72 rust/…/send.rs• L22-124 rust/…/send.rs• L270-347 rust/…/new.rs• L40-145 rust/…/import.rs• L29-159 rust/…/destroy.rs• L27-218 rust/…/connect_onboard.rs• L90-203 rust/…/fanout.rs• L37-66 rust/…/cancel.rs• L44-110

Discovery and gateway commands

Discovery commands help a provider publish or validate a payment-facing description. Gateway commands turn an API or local inference service into a payment-aware endpoint. A gateway may also publish a stable provider identity for decentralized discovery when the operator supplies a public endpoint.

Command groupPurpose
pay skills and pay installManage provider sources and browse the local provider catalog.
pay catalogScaffold, check, build, and validate provider catalog data.
pay gate apiStart a proxy that applies payment rules to an API described by a paywall.
pay gate inferenceFind local inference servers and expose them through a local payment gateway. Without rates, requests pass through free. With sandbox rates, model routes use an x402-up-to allowance and settle from observed token use.
pay gate scaffold, pay gate demoSupport paywall creation and gateway demonstrations. The demo writes a bundled paywall and runs in sandbox mode.
pay plansPreview and prepare subscription plan addresses without starting a gateway.
pay docs schemaEmit the schema used to validate paywall specifications.

pay gate is the visible gateway command family. pay serve and pay server remain hidden aliases for older gateway command lines. The older pay server start path remains accepted as a compatibility form, while new use should follow pay gate. API startup can also terminate native TLS when a certificate and key are supplied. Inference startup can advertise a public URL and register an OpenAI-compatible service on the provider registry, then renew that registration while the process runs. Registration is opt-in through --public-url; --public-url auto is the explicit public-IP discovery mode, and --no-register skips publication. Catalog validation classifies probe results by payment compatibility. A provider needs at least one Solana-payable endpoint, or a gate that the probe cannot verify because it needs credentials or a real resource; strict validation also blocks any non-Solana endpoint. The catalog and skills flows describe what a provider offers. The gateway flows enforce those offers at request time. See CLI skills and catalog and CLI server and inference.

References: rust/…/mod.rs• L89-134 rust/…/mod.rs• L12-46 rust/…/start.rs• L977-1043 rust/…/start.rs• L1522-1607 rust/…/mod.rs• L66-148 rust/…/mod.rs• L399-491 rust/…/verdict.rs• L28-154

Inference selling commands

The pay sell family lets an operator expose a local agent as a paid OpenAI-compatible endpoint. create uses a pay-connect creator bearer to allocate the endpoint and returns its owner token once; serve uses that token to consume queued buyer requests, runs a local ACP agent, and streams each answer back to the endpoint.

The seller chooses a flat request price or estimated per-token rates with a per-request ceiling, plus an overall earnings cap that closes the endpoint when reached. The serving process uses an empty private work directory and refuses agent tool requests by default. A seller must explicitly provide a project directory or enable tools. Management tokens are kept out of the child agent. The worker keeps the agent process available across requests but starts a new agent session for each buyer, and estimates token usage from character counts because ACP does not report exact token counts.

References: rust/…/mod.rs• L121-128 rust/…/mod.rs• L40-162 rust/…/mod.rs• L348-477 rust/…/sell_cli.rs• L8-85

Startup context

Configuration and identity

Every normal invocation creates a shared execution context before it runs the selected command. This context controls identity, network, protocol choice, payment approval, logs, and the form of output. The MCP server is the main exception: it creates its own async runtime and starts directly so its long-lived protocol stream stays isolated from ordinary command handling.

The shared configuration is a small set of defaults for automatic payment, signer fallback, RPC access, and log format. The CLI reads pay.toml from the current directory or ~/…/pay.toml, unless PAY_CONFIG names another file. PAY_ environment variables can override values from the file. Global flags can select an account, force a network, force MPP or x402, cap automatic payment, enable sandbox behavior, or choose machine output for one invocation.

Named accounts live in ~/…/accounts.yml. Account-aware commands prefer the selected account for the active network. A global --account <name> selects a named account for the invocation, and PAY_ACTIVE_ACCOUNT provides an environment-level selection. New or imported local keypairs can use the platform keychain, GNOME Keyring, Windows Hello, 1Password, or a file fallback. Remote signing backends use provider-declared credentials and wallet identifiers; credential values must come from protected files, environment variables, or prompts rather than command-line values. Legacy keypair settings remain a fallback for commands that do not use the account policy path.

The account model keeps network choice and signer choice together. This prevents a local or sandbox request from using a mainnet identity by accident. Sandbox and other throwaway networks can create temporary wallets when the command supports that mode. Gateway commands also use a dedicated gateway account as a local fee payer when sandbox mode needs one. Removing an account deletes stored credentials when the backend owns them, but it does not delete user-managed file keypairs or wallets held by a remote provider.

References: rust/…/config.rs• L18-129 rust/…/main.rs• L134-168 rust/…/main.rs• L227-334 rust/…/new.rs• L148-207 rust/…/destroy.rs• L138-165

Network and protocol selection

The CLI treats mainnet, devnet, testnet, and localnet as distinct payment contexts. --sandbox and --local force localnet behavior. --mainnet forces mainnet behavior. Without an override, a paid request follows the network advertised by its challenge.

The CLI can also force the payment protocol used for a challenge. --x402 accepts only x402 challenges. --mpp accepts only MPP challenges. With neither flag, the payment runtime selects a supported challenge from the server offer and the available account balance.

Sandbox mode changes both routing and safety expectations. It uses a localnet wallet and a Surfpool RPC by default, so the command can exercise payment flows without moving mainnet funds. The CLI rejects a forced protocol or network mismatch instead of silently changing the user's choice. The same localnet rule applies when a gateway is started with sandbox mode, even if its paywall names another network.

References: rust/…/main.rs• L48-79 rust/…/main.rs• L214-286 rust/…/network.rs• L3-53 rust/…/mod.rs• L251-289

Invocation lifecycle

The invocation lifecycle converts command-line intent into either a completed command or a long-running payment service. The main entry point parses flags, loads shared configuration, applies safety overrides, initializes logging, and dispatches the command. It also starts first-run setup for payment-bearing commands when no account exists, while sandbox commands can create an ephemeral account without touching the user's main account. Token-authenticated pay sell commands do not require a Pay account. Hidden aliases preserve older gateway command lines, while the top-level plans and docs families keep offline preparation and documentation tasks outside the gateway lifecycle.

The internal pay __acp-buzz-relay path is handled before normal argument parsing. It exists only for a Buzz-managed ACP child and does not load ordinary CLI configuration or start another command flow.

The following diagram shows the high-level path for a payment-bearing command.

flowchart TD
    A[CLI arguments] --> B[Parse command and global flags]
    B --> C[Load config and account context]
    C --> D[Apply network and protocol rules]
    D --> E{Account needed?}
    E -- No --> F[Run informational or setup command]
    E -- Yes --> G{Account available?}
    G -- No --> H[Start setup or return a clear error]
    G -- Yes --> I[Run command]
    I --> J{Payment challenge?}
    J -- No --> K[Return response or command result]
    J -- Yes --> L[Select and sign payment]
    L --> M[Retry request through payment runtime]
    M --> K

Payment-bearing commands normally trigger setup on a fresh install. ACP exits with a setup instruction because it must keep its standard input and output available for its protocol. Sandbox commands are exempt because they can create an ephemeral wallet on first use. Automatic payment is enabled for HTTP tools, agent launches, sandbox runs, and explicit --yolo-upto use, while the cap limits which stablecoin-denominated offers can be signed. Gateway startup follows its own paywall-based signer and recipient checks before it accepts traffic.

References: rust/…/main.rs• L102-165 rust/…/main.rs• L352-396 rust/…/mod.rs• L151-195 rust/…/setup.rs• L59-165 rust/…/mod.rs• L348-372 rust/…/start.rs• L1522-1607

Runtime interaction

The CLI is the user-facing boundary for the payment runtime. It does not define a separate payment system for each command. Instead, it turns command inputs into runtime requests and turns runtime outcomes into terminal or machine output. The runtime owns challenge handling, credential creation, verification, retry, and receipt data.

The HTTP tools share one payment-aware retry model. An upstream server first returns a payment challenge. The CLI selects a compatible MPP or x402 offer, checks any automatic payment cap, signs the required credential, and retries the same request. A successful retry returns the upstream body and exit status.

The built-in fetch command follows the same model without requiring an external binary. It supports simple bodies and multipart requests, and it keeps file-backed request bytes stable across a paid retry. The wrapper commands pass their normal arguments through while the shared runtime handles the challenge. Before signing, the CLI can check supported request forms against the cached provider catalog so a payment is not made for a request that the catalog does not describe.

The following sequence shows how a paid request crosses the CLI and runtime boundary.

sequenceDiagram
    participant U as User or agent
    participant C as pay CLI
    participant R as Payment runtime
    participant S as Paid server

    U->>C: Run HTTP or agent request
    C->>S: Send request
    S-->>C: Response or 402 challenge
    C->>R: Decode offer and resolve account
    R-->>C: Payment credential
    C->>S: Retry request with credential
    S-->>C: Paid response and receipt
    C-->>U: Body, status, and result

Automatic payment is enabled for HTTP tools, agent launches, sandbox runs, and explicit --yolo-upto use. The shared boundary can surface MPP charge, subscription, or session challenges and x402 exact, up-to, batch, or sign-in challenges when automatic payment is disabled. Other flows can expose the challenge instead of signing it. The CLI payment operations page covers the command-specific payment forms.

References: rust/…/mod.rs• L231-407 rust/…/mod.rs• L410-506 rust/…/mod.rs• L679-875 rust/…/mod.rs• L1659-1835

Agent and MCP interaction

MCP is the bridge between Pay and agent clients. pay mcp runs the MCP server directly. Setup can add that server to supported client configuration so an agent can call payment-aware tools without learning the CLI command surface.

When an agent cannot handle a 402 response itself, the CLI starts a loopback payer proxy. The proxy buffers a request so it can retry once, streams the final response back, and passes an unpaid 402 through when payment fails. It supports reusable MPP sessions and x402 batch channels across requests. It can also translate an Anthropic messages request to an OpenAI-compatible upstream and translate the response back. Successful hosted inference routes must present a payment challenge, except for public model discovery.

The ACP middleware preserves client and adapter JSON-RPC frames while it observes them for managed delivery. If the model does not publish its final Buzz message, the parent can publish the assistant text as a fallback. The adapter never inherits the parent-only Buzz key. A separate loopback relay validates a launch token, the active conversation, and the limited messages send command before it uses the parent's Buzz credentials.

The regular agent launchers use the native provider by default. The alternate-provider path discovers compatible local or catalog providers, lets the user select one when interactive, and routes the child process through the payer proxy. ACP supports deterministic provider and model selection for headless use. Hosted catalog providers supply their service URL, endpoint paths, model list, dialect, and pricing hints. The payer proxy uses those declarations to choose paths and translate supported API dialects without exposing the payment account to the child.

References: rust/…/main.rs• L107-164 rust/…/setup.rs• L464-675 rust/…/payer_proxy.rs• L1-34 rust/…/payer_proxy.rs• L325-427 rust/…/payer_proxy.rs• L588-685 rust/…/payer_proxy.rs• L912-1085 rust/…/acp.rs• L84-207 rust/…/acp_middleware.rs• L28-170 rust/…/acp_buzz_relay.rs• L289-407

Gateway startup

Gateway commands turn a paywall or discovered inference provider into a long-running HTTP service. Before serving traffic, the gateway resolves the network, signer, recipient, currencies, and payment accounts. It validates the paywall and prepares the payment backends so a bad configuration fails at startup instead of on the first paid request.

The gateway can run in client-funded mode or sponsor transaction fees with an operator signer. Sandbox mode pins the gateway to localnet, uses Surfpool by default, funds local wallets when possible, and prepares missing payout token accounts. API and priced inference gateways share this payment setup. Session and replay state is in memory for local use, but hosted or deployment gateways require shared durable storage. The release CLI includes the Redis session-store capability by default, and Redis URLs fail clearly when the binary lacks that feature. Session close and settlement remain owned by the active gateway. For x402 batch settlement, a memory-backed gateway runs the claim, distribution, close, and reclaim lifecycle; a Redis-backed deployment leaves those sweeps to the external worker and exports batch value and lifecycle metrics.

Session pricing is expressed as a USD amount settled one-to-one in token base units. Startup therefore accepts recognized USD-pegged currencies, or explicitly enabled benchmark test mints, and rejects other assets before the gateway serves traffic. Deployment session policies require one network-matched USDC currency. The API gateway can serve a filtered OpenAPI or Discovery document. The document points clients at the proxy rather than the upstream service. Local inference without rates remains free passthrough. A rates file or --price turns model routes into sandbox-only x402-up-to endpoints with per-model token rates; the gateway settles the measured token cost after the response. Model-list and health routes remain free. Inference startup validates rates against the models it discovers, probes the bind address before launch, and can expose a local web view or run headless. Its TUI shows live provider status and connection totals, including request results, token counts, paid value, and the latest activity; it can filter errors or providers and open the web view.

This diagram shows how gateway configuration becomes a payment-aware service.

flowchart TD
    A[Paywall or discovered provider] --> B[Resolve network and RPC]
    B --> C[Resolve operator and payout accounts]
    C --> D[Validate routes and payment rules]
    D --> E[Prepare sandbox wallets and payout accounts]
    E --> F[Create challenge and settlement backends]
    F --> G[Serve free and paid routes]
    G --> H[Verify payment and forward upstream]
    H --> I[Settle charge or session]

References: rust/…/start.rs• L65-121 rust/…/start.rs• L1188-1265 rust/…/start.rs• L1522-1607 rust/…/start.rs• L1904-2023 rust/…/start.rs• L2614-2725 rust/…/payments.rs• L23-78 rust/…/payments.rs• L219-332 rust/…/payments.rs• L617-720 rust/…/Cargo.toml• L11-23

Subscription lifecycle

Subscription commands manage the local view of recurring MPP payment rights. Activation records the server-issued subscription ID with its account, network, plan, terms, and on-chain delegation data. The later commands use that record to inspect, cancel, or repair local metadata.

The lifecycle has two separate state paths. On-chain cancellation ends future renewal while access remains available through the paid period. The CLI marks the local record as cancelled and later removes it after the recorded period end. If the subscriber does not have enough SOL for the cancel transaction, the CLI discovers a gateway charge, asks for approval, and sends a partially signed transaction for sponsored settlement.

CLI HTTP retries also try to record a successful subscription activation in the local registry. If the wrapper cannot preserve the server receipt needed for the opaque subscription ID, the CLI keeps a deterministic local key and exposes refresh as the repair path. This keeps later status and cancellation commands usable without treating a local write failure as a failed on-chain activation.

pay subscriptions list and pay subscriptions status support machine-readable views for scripts. pay subscriptions refresh looks up a missing activation transaction through the subscription's network RPC and stores the result. The subscription ID is the primary local lookup key; older records may use the delegation address as that ID.

References: rust/…/mod.rs• L17-66 rust/…/cancel.rs• L38-110 rust/…/cancel.rs• L181-338 rust/…/list.rs• L24-87 rust/…/refresh.rs• L33-113 rust/…/status.rs• L21-105 rust/…/mod.rs• L1472-1550

Output and observability

Human and machine output

The CLI serves both people at a terminal and programs that need stable data. It keeps command results on stdout, operational notices and logs on stderr, and changes the detail level based on the caller's mode.

Human mode uses notices, tables, colors, links, and progress displays. Machine mode uses JSON and avoids interactive prompts. The CLI enters machine-oriented mode when NO_DNA is set or when --no-dna is passed. When no explicit format exists, a terminal receives text and a pipe receives JSON.

Errors use the same split. Human callers receive a short notice that distinguishes payment rejection from configuration failure. Machine callers receive a JSON error object on stderr or a structured payment result on stdout. Paid HTTP responses still preserve the upstream body and exit code when the request completes. Direct transfers report the amount, total paid amount when fees are added, and a transaction receipt link. Account balance views keep notices and balance details on stderr, so scripts do not mistake display text for a command result.

References: rust/…/no_dna.rs• L3-33 rust/…/output.rs• L3-35 rust/…/main.rs• L403-410 rust/…/account.rs• L19-72 rust/…/list.rs• L114-203 rust/…/send.rs• L102-153

Receipts and logs

Verbose mode adds a payment challenge summary before payment and receipt details after a paid retry. The summary groups the advertised protocol and payment form with its terms and network. Receipt output can include a receipt URL or a Solana explorer transaction link. Normal response bodies remain separate from these notices so a caller can still consume the response.

Runtime logs default to warnings. Verbose mode enables more Pay logs. Server and gateway commands can export traces and metrics to an OTLP sidecar. The CLI sends traces to the sidecar's /v1/traces endpoint and metrics to /v1/metrics, preserves incoming trace context, and flushes initial metric baselines. PAY_OTEL_TRACE_SAMPLE_RATIO controls trace sampling from zero to one.

References: rust/…/mod.rs• L957-1073 rust/…/main.rs• L522-595 rust/…/observability.rs• L39-130 rust/…/start.rs• L1013-1020

Debugger integration

The Payment Debugger provides a view of proxied requests, payment flows, receipts, and inference activity. The global --debugger flag starts a loopback proxy before an agent launch and passes its address to the MCP path. The proxy forwards requests named by X-Pay-Forward-To and records the exchange in the debugger state. It starts at port 1402 and tries later ports in fixed steps when that port is busy. Gateway commands can also start the debugger alongside the service, with sandbox API gateways enabling it by default. The demo always enables it.

The debugger is an observation path, not a replacement for payment verification. The payment runtime still decides whether a challenge is valid and whether a request may proceed.

References: rust/…/main.rs• L197-212 rust/…/debugger_proxy.rs• L21-260 rust/…/start.rs• L1009-1016 rust/…/demo.rs• L54-69

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the root command enum, the help categorization, the visible gate family, hidden migration aliases, the top-level plans workflow, the sell family, and the machine-readable command catalog aligned when adding or renaming a visible command.
  • Keep account lookup, network choice, RPC selection, signer policy, and remote-wallet credential handling aligned across setup, account creation and removal, direct sends, fanout payouts, HTTP payments, agent launchers, gateways, and subscription cancellation.
  • Keep payment challenge parsing, automatic cap checks, retry behavior, receipt display, and pre-sign catalog validation aligned across wrapper tools and the built-in fetch path.
  • Keep ACP provider and model overrides aligned across command flags, environment variables, provider discovery, and each harness's expected configuration. Preserve transparent stdin/stdout for ACP JSON-RPC.
  • Keep parent-only ACP credentials out of adapters and agents. Keep the Buzz relay limited to the active conversation and the allowed send options.
  • Keep hosted catalog endpoint paths, dialect detection, model-list parsing, model-family filtering, pricing hints, and fallback providers aligned with the payer proxy routes. Preserve the rule that hosted completion routes need a payment challenge.
  • Keep catalog probe verdicts aligned with provider publication rules. Credential-gated and parameterized endpoints must remain distinct from free, broken, and non-Solana endpoints, especially under strict validation.
  • Keep inference provider compatibility, provider discovery, token pricing, observed usage, x402-up-to settlement, gateway discovery documents, public URL registration, and provider registration metadata aligned when adding a provider or changing an API dialect.
  • Keep gateway network pinning, fee-payer selection, payout recipient account preparation, session-store feature support, TLS setup, and batch lifecycle ownership aligned across sandbox and production startup.
  • Keep session currency checks aligned with USD pricing and deployment policy. Do not allow a non-pegged asset or an unsupported benchmark mint to enter a session gateway.
  • Keep shared Redis prefixes and durable-store requirements aligned across sessions, charge replay, subscription proofs, and x402 batch channels. A process-local store must remain limited to local test networks, and batch reconciliation must have one owner.
  • Keep human notices and machine JSON contracts distinct when changing errors or payment outcomes. Do not write diagnostic text into a response body that callers consume.
  • Keep OTLP trace context, trace and metric endpoint paths, sampling rules, and shutdown flushing aligned when changing gateway observability.

Important failure modes

TriggerConsequenceGuard
A payment command runs without any configured account outside sandbox modeThe command cannot sign a payment and exits during first-run handlingRun setup first. The CLI starts setup for most payment-bearing commands and gives ACP a direct setup error.
A token-authenticated sell command is treated as an account-bearing commandpay sell create or pay sell serve stops before it reaches pay-connectKeep the sell family outside requires_account; its bearer tokens authenticate the control-plane calls.
A sell worker passes its owner or creator token to the ACP childA buyer-controlled agent could use credentials that manage the endpointRead the token before spawn, remove management-token variables, and keep the default work directory empty.
A Buzz ACP adapter receives the parent private key or an unrestricted buzz commandA compromised agent could use the key or act outside its active conversationScrub parent-only variables. Use the short-lived relay token and allow only buzz messages send to a live channel.
Automatic payment is requested for an amount above --yolo-uptoThe challenge is rejected locally and no credential is signedThe cap is checked before MPP, subscription, session, and x402 payment signing.
--sandbox is combined with a mainnet challenge or a mainnet-only account selectionThe request is refused instead of risking a mainnet paymentSandbox forces localnet routing and the payment credential path checks the challenge network.
A catalog provider has no Solana-payable endpoint and no credential-gated or parameterized endpointCatalog validation blocks the provider; strict mode also blocks any non-Solana endpointTreat ok, credential-gated, parameterized-404, free, broken, and non-Solana probe results as separate verdicts.
A hosted inference route returns success without the expected payment challengeThe payer proxy returns a gateway error instead of allowing an ungated hosted responseHosted routes require a challenge, except for public model discovery.
A request body exceeds the payer proxy replay limitThe proxy returns 413 Payload Too Large before forwarding the requestThe proxy caps buffered bodies at 32 MiB.
An inference pricing file is used without sandbox modeGateway startup stops because mainnet per-token charging is not enabledUse inference pricing with --sandbox.
A session gateway uses a non-USD-pegged currency or an unapproved benchmark mintStartup stops before it can advertise a price that would settle incorrectlyUse a recognized USD-pegged asset, or explicitly enable and configure the benchmark test mint.
An inference pricing file names models that are not discovered or leaves a provider without a matching rate or defaultGateway startup stops before it accepts trafficValidate pricing against the discovered model set and provide a matching rate or default.
A configured gateway payout recipient has no required stable token account on a real clusterGateway startup stops before it accepts trafficCreate the associated token account or use the Surfpool localnet sandbox where Pay can create it.
A hosted or deployment gateway uses memory for replay or session stateA restart or second replica can accept a credential more than once or lose channel stateUse the default Redis-enabled build and configure shared Redis URLs for non-local deployments.
A Redis URL is set but the binary lacks the Redis session-store featureGateway startup stops instead of silently using memoryBuild the CLI with redis-session-store, or remove the Redis setting.
A public gateway URL is supplied but no account can sign provider registration, or an existing registry entry has different metadataThe gateway serves only when registration is skipped or the conflict is fixedUse an active account, pass --no-register when publication is not needed, or fix the conflicting entry.
A local inference gateway bind address is already in useGateway startup fails with an actionable conflict messageFree the port or pass a different --bind value.
Only part of a gateway's native TLS configuration is suppliedCommand parsing rejects startup before the service runsProvide both --tls-cert and --tls-key.
PAY_OTEL_TRACE_SAMPLE_RATIO is outside the range 0 to 1OTLP startup fails before the gateway serves trafficSet a numeric sampling ratio in the allowed range or omit it.

Key files

FileWhy to read it
rust/…/main.rsPrimary startup path. It applies global flags, loads shared context, selects output mode, initializes logging, starts first-run setup, and dispatches commands.
rust/…/mod.rsRoot command surface and the shared HTTP challenge, catalog validation, payment, retry, and receipt boundary.
rust/…/config.rsConfiguration sources and signer fallback rules shared by the CLI and runtime.
rust/…/payer_proxy.rsLocal bridge that lets agent clients use paid inference providers, including protocol reuse, replay, API translation, and response streaming.
rust/…/acp.rsACP harness selection, provider and model overrides, child-process protocol setup, and environment isolation.
rust/…/acp_middleware.rsACP frame forwarding and managed Buzz delivery fallback.
rust/…/acp_buzz_relay.rsRestricted parent-side relay for Buzz replies from a managed ACP child.
rust/…/verdict.rsProvider and endpoint verdicts used to decide whether catalog data is publishable.
rust/…/mod.rsVisible gateway command families, top-level plan workflows, and hidden compatibility aliases.
rust/…/start.rsPaywall gateway startup, session currency checks, route validation, TLS and signer setup, provider registration, service lifecycle, and batch settlement ownership.
rust/…/payments.rsShared sandbox funding, payout-account preparation, challenge backends, blockhash setup, and store-related payment support.
rust/…/mod.rsLocal provider discovery, free passthrough, sandbox pricing, live tracking, registration, and gateway lifecycle.
rust/…/inference.rsLive inference provider and connection view, filters, follow-latest behavior, and web UI control.
rust/…/setup.rsFirst-run account setup, browser-linked account choice, activation redemption, and integration installation for MCP and agent clients.
rust/…/observability.rsOTLP trace and metric export, trace propagation, sampling, and provider shutdown.
rust/…/Cargo.tomlBuild features that affect gateway capabilities, including the default durable Redis session-store support.