primer · anyway

Four Anyway kernels, demystified.

Every idea in this repo leans on one of four Anyway kernels: a paid SuperAPI call, an Agent Wallet that spends on its own, a payment link that gets you paid, or Agent Traces that make the run auditable. Each runs against the public Anyway API from a TanStack server function — no infra, no vendor-by-vendor signup.

pay-per-call data

Anyway SuperAPI Call

Kernel: an x402 paid API call through Anyway SuperAPI — discover with `GET https://marketplace-prod.anyway.sh/v1/api/directory`, read the endpoint from `/v1/api/info/{upstream_id}`, then call the `curl_x402` URL and settle in USDC from an Agent Wallet (60+ APIs: web search, social, crypto, markets, AI — no per-vendor keys)

UI: a topic box that returns live, paid-for results the user can read, cite or drop into the work

autonomous spend

Anyway Agent Wallet

Kernel: the Agent Wallet Runtime API (`https://api.anyway.sh/v1/agent-wallet`, `/policies`, `/history`, `/credit-balance`) — an agent's own USDC wallet on Base with an owner-set spending policy enforced server-side

UI: a wallet panel showing identity, spending policy, credit balance and a live feed of what the agent just paid for

get paid

Anyway Payment Links

Kernel: Anyway payment links and the Merchant API — generate a shareable USDC/fiat link for a creative service, then read orders, customers and settlements back over `https://api.anyway.sh`

UI: a service page with a price, a one-tap payment link and a live list of paid orders

see the run

Anyway Agent Traces

Kernel: the Anyway tracing SDK (`@anyway-sh/node-server-sdk`, or `anyway-sdk` in Python) exporting OTLP to `https://collector.anyway.sh` — `withWorkflow / withAgent / withTask / withTool` records every step, token count, duration and cost

UI: a run view: the workflow tree, per-step timings, tokens and the USDC cost of the run

How an x402 call actually works.

  1. Discover. GET marketplace-prod.anyway.sh/v1/api/directory lists every upstream, its paths, health and per-call price.
  2. Inspect. GET /v1/api/info/{upstream_id} returns the callable x402 URL. Never hardcode an endpoint.
  3. Call. An unpaid request answers 402 with a price quote.
  4. Settle. The Agent Wallet signs the payment and retries with an X-PAYMENT header. Organization credits are spent before wallet USDC.

Two secrets, max.

Add these in Lovable (Project Settings → Secrets). They stay on the server, read inside a TanStack server function via process.env — never with a VITE_ prefix. Most builds only need the first one.

  • ANYWAY_AGENT_WALLET_KEY

    Agent Wallet Key from app.anyway.sh/wallets?view=agent (or `anyway login --agent-wallet`). Lets your agent pay x402 endpoints in USDC under a spending policy you set once.

    Get key ↗
  • ANYWAY_API_KEY

    Business API key from Business profile → Developers. Used for orders, payment links, and reporting Agent Traces to collector.anyway.sh.

    Get key ↗
Build strategyLive SuperAPI demoLive payment demoBrowse 1,000 ideas