CASE STUDY / EXAMPLE PRODUCT WORKFLOW

One call.
A complete payment trail.

How an agent pays for inference with a Stock Token, without changing the model request.

A walkthrough of the Stock Token payment flow as Anyroute implements it. It is not a customer result, a record of a live transaction or an investment recommendation.

The starting point

A developer wants a research agent to run within a clear spending boundary. The agent uses a familiar chat API, while its capped session wallet holds a supported Stock Token. The goal is to connect those two systems with an auditable payment trail.

  1. 01 / Set the boundary.

    The developer chooses a registered token and a daily limit. The wallet opens a session on the PayWithStock contract for this key, capped in token units per UTC day. The router can only spend within that cap, and the owner can close the session instantly. The agent never gets unrestricted spending authority.

  2. 02 / Route the request.

    The API request keeps its usual model and messages. A payment header expresses the preferred token. The call is priced in USDG and routed to an eligible provider.

    Payment preference
    {
      "endpoint": "POST /api/v1/chat/completions",
      "headers": {
        "Authorization": "Bearer <ANYROUTE_API_KEY>",
        "X-Pay-With": "NVDA"
      },
      "body": {
        "model": "author/model",
        "messages": [
          {
            "role": "user",
            "content": "Your prompt"
          }
        ]
      }
    }
  3. 03 / Settle with limits.

    Small call costs accrue in USDG. At $1, or after 24 hours, the router asks the contract to swap exactly the USDG owed: the contract reads the Chainlink fair value (which already includes the token’s multiplier), enforces the slippage bound and the daily cap, and credits the key. If the oracle is stale or paused, the call falls back to prepaid USDG when available, or returns a payment-required state.

  4. 04 / Keep the evidence.

    The generation receipt identifies the model, provider, token usage and USDG cost. After allocation, its payment details identify the Stock Token units, fair-price input and swap transaction. A later anchor adds proof of inclusion.

USER CONTROL

Cap. Pause. Close.

A clear spending boundary and an immediate way to end a session.

VERIFIABLE RESULT

Follow the receipt.

Generation, cost, token allocation and settlement evidence in one trace.

Try it

Open a session in the dashboard’s Payments tab, choose NVDA in the playground and inspect the receipt’s paid-with line. The monthly statement lists every swap with its per-call token allocation. A sample workspace with fictional values is also available if you only want to explore.

Try the payment workflow