It has three parts, each building on the last:
- Paid calls: two nodes paying each other from seeded credit. Needs only Docker.
- The dashboard: sign in, enroll and list nodes, create API clients, and view balances. Needs nothing beyond part 1.
- Stripe end to end: buy credits by card, onboard to Connect, and receive a payout, all in Stripe test mode.
Prerequisites
- Node.js 20+ and pnpm
- Docker with the daemon running
- For part 3, the Stripe CLI
.env is copied into its image, so after changing one, rebuild that service with docker compose up -d --build <service>. A restart isn’t enough.
Part 1: Paid calls
1
Generate node keys
This writes each node’s
.env, and a root .env with their public keys, which the operator’s seed reads. It refuses to overwrite existing files:2
Start the services
org_local_provider and org_local_caller, enrolls each node’s key in one of them, marks the provider as able to receive payouts, and gives the caller $10 of credit. Restarts don’t add more credit.3
Run a paid request
com.example.Weather.temperature costs $0.01:Response
return echo.complete(prompt: "Hello world!", maxTokens: 10) with const echo: com.example.Echo. It holds the most the call can cost and charges only the tokens it used.4
Run a script as an API client
The seed also lists the resource node at $1 per million script tokens, and gives the caller’s organization an API client for it, The caller’s organization pays $0.01 for the temperature, plus 17 tokens at $1 per million, from the run’s hold. The provider’s organization is owed both, less the fee. The run is in the operator’s
cli_local_caller. Run the same script directly on the resource node, without either node’s API key:runs table.Part 2: The dashboard
The dashboard signs people in with Better Auth, which runs inside the operator: users, sessions, organizations and roles are tables in its Postgres. Compose sets a localBETTER_AUTH_SECRET, so there is no account to create anywhere else.
1
Configure the dashboard
apps/dashboard/.env
RESEND_API_KEY, the operator doesn’t send email: it logs each verification, password reset and invitation link instead. Find them with docker compose logs operator | grep Email. To send real email, or to offer GitHub sign-in, add to apps/operator/.env:apps/operator/.env
GITHUB_SIGN_IN=true to apps/dashboard/.env, so the sign-in page shows the button.To enroll the nodes from the dashboard instead of the seed, add SEED_DEV=0 to the root .env. Then reset the stack and start the operator and dashboard:2
Create organizations and enroll the nodes
Open http://localhost:3010 (not 127.0.0.1: the operator accepts only the dashboard’s origin) and sign up, then open the verification link from the operator’s log. Create two organizations from the organization switcher: one to pay for calls (say “Caller”) and one to host the paid functions (“Weather Provider”).For each, select the organization, go to Nodes, and create an enrollment token. A token is shown once and works once, within 24 hours. Add its Each node presents its token at startup and joins its organization. After that it needs only its signing key. A provider that isn’t enrolled refuses to start and says how to enroll it.The provider’s paid calls are refused until its organization can receive payouts, and the caller has no credit yet. Part 3 sets up both.
ENROLLMENT_TOKEN=... line to that node’s .env, then start the provider first, since the caller bootstraps from it:3
List the provider and create an API client
In the provider organization, go to Nodes. Under Listings, give the resource node a name and a price per million tokens, check Listed, and save. The operator checks that the node’s URL answers with its key before listing it.Switch to the caller organization. The node appears on Explore. Click Create API client, set a maximum per run, and create it. The client’s secret is shown once, with a ready-to-run example: replace the node URL in it with
http://localhost:3002, since the listed URL is the one Compose’s network uses. Once the caller has credit (part 3), the run’s charges appear under Usage → Runs spent.Part 3: Stripe end to end
1
Get Stripe test keys
In the Stripe dashboard, turn on Test mode, then:
- Under Developers → API keys, copy the Secret key (
sk_test_...). - Under Settings → Connect, finish Get started as a platform or marketplace. Connect is needed to create the providers’ Express accounts.
- Under Settings → Billing → Customer portal, click Activate test link. The dashboard’s Manage in Stripe button opens this portal.
2
Forward webhooks
Keep this running in its own terminal:It prints a webhook signing secret (
whsec_...). One stripe listen signs both streams, so the same secret goes in both variables. Add these to apps/operator/.env, then rebuild the operator with docker compose up -d --build operator:apps/operator/.env
3
Buy credits as the caller
Select the caller organization, go to Credits, and click Buy credits. Pay on Stripe Checkout with card 4000 0000 0000 0077, any future expiry and any CVC.After Stripe redirects you back, the balance updates within a few seconds, once the
checkout.session.completed webhook arrives.4
Set up payouts as the provider
Select the provider organization, go to Payouts → Set up payouts, and complete Stripe’s test-mode Express onboarding:
- Phone 000 000 0000, with SMS code 000000.
- An individual with any name, address and date of birth (over 18), and SSN last four 0000.
- For the bank account, choose Test (OAuth) and pick the Success account. If an “enter bank details manually” link is offered instead, use routing number 110000000 and account number 000123456789.
account.updated webhook arrives.5
Get paid
Make a few paid calls from the caller with the
curl command in part 1. On the next maintenance pass, the operator transfers the provider’s earnings, in whole cents, to its Express account. The remainder stays payable until a later payout. You can see the payout in three places:- The provider’s Payouts page in the dashboard.
- The caller’s Usage page, where each call shows what it was charged.
- Stripe:
stripe transfers list --limit 1.
PAYOUT_* lines from apps/operator/.env and rebuild the operator. Otherwise it pays out every 30 seconds.Resetting
Postgres has no volume, sodocker compose down deletes every organization, balance and receipt. The next docker compose up -d --build starts fresh and reseeds, unless SEED_DEV=0 is set. After a reset, nodes enrolled through the dashboard need new enrollment tokens. Dashboard accounts and organizations are in Postgres too, so they’re gone. Stripe’s test data is kept.