Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
25 KiB
Vend — historical product thesis
Document class: historical strategy, not current implementation. Vend now ships as a standalone Rust product in
apps/vend. The operational contract, supported funding mode, routes, environment, and launch workflow live inapps/vend/README.md. Statements below describe the original product thesis and may include roadmap capabilities that are not in the current release.Current dependencies: Vend Postgres metadata, Relay inference, and Mint settlement. Mint's protocol reference is AITP-402.
1. One-liner
Stripe-meets-OpenRouter: get a resellable, metered AI SDK live in an afternoon — white-label inference gateway + reserve-backed wallet, dunning and failover included, settling on AITP-402.
Every vertical-AI SaaS that resells model access needs the same four things it refuses to build: a gateway, metered billing, dunning, and provider failover. Vend ships all four as a drop-in, multi-tenant product. Each customer that adopts Vend becomes a distribution channel for the AITP-402 rail.
2. Problem & thesis
The problem
Thousands of "AI-for-X" apps (AI tutor, AI legal drafting, AI SDR, AI coding tool, vertical copilots) resell frontier-model access as their core value. To do that safely they each must build:
- A gateway — one OpenAI-compatible endpoint fanning out to many providers, with keys, rate limits, and per-provider fallback.
- Metering — exact per-request cost capture in integer money, attributed to the right end-user, with markup.
- Billing plumbing — prepaid wallets, top-ups, auto-recharge, invoices, receipts, dunning (retrying failed cards, downgrading, notifying).
- Failover & policy — reroute when a provider 500s/rate-limits; never charge the end-user for a failed generation.
Founders refuse to build this. It is undifferentiated, error-prone (float money bugs, double-charges, charging on failure), and a compliance/finance liability. They either (a) eat OpenAI billing directly and cannot mark up or meter per seat, or (b) bolt Stripe metered billing onto a hand-rolled proxy and spend a quarter on edge cases. Neither gives them a resellable wallet their own customers can top up.
The thesis
The durable, high-switching-cost asset in AI monetization is the metered wallet + reserve ledger sitting under thousands of apps, not any single model or gateway. Gateways are increasingly commoditized; the ledger of record for spend is not. Once an app's customers hold prepaid balances in your wallet and its finances reconcile against your receipts, ripping you out means a billing migration — the single most-avoided engineering project there is. Take-rate compounds silently on top.
Vend is the purest picks-and-shovels expression of the payments thesis: it does not try to win an end-market. It sells the rail, and makes every customer a distribution channel for AITP-402. The strategic prize is not gateway revenue — it is becoming the settlement layer (Mint) that thousands of AI apps clear spend through, which is the billion-dollar wedge (see §8).
3. Why now
- Reselling model access is the default vertical-SaaS pattern — every YC batch is full of "AI + vertical" apps that are, financially, resellers of tokens. The metering/billing pain is now universal, not niche.
- The primitives already exist in this repo. This is not a from-zero build:
ReelForge's
gatewaydomain already does provisioning keys + markup + reseller caps; thewalletdomain is an integer-microdollar ledger with Stripe webhooks; Relay is a working OpenRouter clone; Mint specs the settlement layer + AITP-402. Vend is multi-tenant packaging + a top-up page, not new infrastructure. - x402 / agent-payment momentum. HTTP-native machine payments (x402-shaped) are moving from thought-experiment to shipping. AITP-402 is a fiat-backed, no-crypto implementation of that shape. Being the white-label wallet under many apps is how you seed a payment standard: adoption comes bundled with a product founders already want.
- Weakness window vs incumbents. OpenRouter and Portkey own the gateway, but neither ships a white-label, reserve-backed wallet your customers top up under your brand. That gap is the wedge, and it closes if they build it — so speed matters.
4. The narrowest wedge + first customer
Wedge (sharp, single-buyer, self-serve)
"Drop in a resellable AI SDK before lunch." A founder installs one SDK, points it at Vend, and gets:
- an OpenAI-compatible endpoint (no per-provider integration),
- automatic per-request metering with their markup baked in,
- a hosted, white-label top-up page their end-users pay into,
- success-only billing + provider failover for free.
The buyer is a single technical founder/eng lead. No committee. No sales call.
The "aha" is measured in an afternoon: from npm i to first metered, marked-up,
successfully-billed request.
First customer (design partner profile)
A seed-stage vertical-AI SaaS with 50–500 paying end-users, currently either eating raw OpenAI cost or running a fragile homemade proxy, that wants to (a) mark up token cost per seat and (b) let power users buy top-up credit. Concretely: an AI writing/coding/analysis tool where usage is spiky and per-user metering matters.
Beachhead sequencing:
- Land 1 design partner who replaces their homemade proxy with the Vend SDK.
- Prove the top-up page converts (their users actually buy credit).
- Template that into self-serve onboarding for the next 20 apps of the same shape (AI-writing/coding/analysis resellers), then widen.
5. How it reuses ReelForge / Relay / Mint (concrete)
Vend is ~80% assembly. Mapping each capability to existing code/plans:
From ReelForge apps/api (Python) — the resale core, already tested
domains/gateway/provisioning.py—ProvisioningKey(per-key daily UTC spend cap viacheck_spend/remaining) andMarkupPolicy(apply_markup, integer-microdollarmarkup_bps+min_fee_micros,margin). This is the reseller metering + cap engine. Vend multi-tenants it: the cap/markup config becomes per-tenant, and keys are scopedtenant → app → end-user.domains/gateway/service.py— persistent key mint (secret returned once), secret-hash resolution, andauthorize + record chargeapplying markup and gating the daily cap against recordedGatewayUsage. Vend adds a tenant column and per-tenant usage rollups.domains/gateway/router.py—POST /gateway/keys,/keys/{id}/quote,/keys/{id}/revoke. Becomes the tenant-facing management API (namespaced).domains/wallet/—service.py,policy.py(versioned fee schedule:_DEFAULT_FEE_RATE_BPS, min/max fee, top-up bounds — already config-not-const),webhooks.py(Stripe),repository.py,schemas.py. This is the integer-µ$ ledger + top-up + fee engine. Vend reuses it wholesale for balances and the hosted top-up page's backend;TopUpErrorbounds and the fee-schedule versioning carry straight over.domains/gateway/media_router.py/media_gateway.py— provider fan-out + fallback pattern (image/media today). The routing-with-fallback shape is the template for LLM provider failover.- Shared invariants — ADR-0001 integer-microdollar money and ADR-0002 success-only billing are already enforced here; Vend inherits both, so "never charge on failure" and "no floats" are free.
From Relay apps/relay (Rust) — the inference plane
- OpenAI-compatible surface (
/api/v1/chat/completions+ completions/embeddings, SSE streaming, tool calling, structured outputs, multimodal) — Vend's data-plane endpoint is Relay's, exposed per-tenant. - Smart routing / provider manifests (
providerobject:order,allow_fallbacks,sortby price/latency/throughput; model suffixes:nitro/:floor) — this is the failover + policy layer founders won't build. - BYOK-with-%-fee, prepaid credits, per-key spend + rate limits, Cost API
(
/generation?id=) — Relay already exposes exact per-request spend, which is the metering signal Vend attributes and marks up. - Web3 on-ramp — optional top-up path alongside Stripe.
Language boundary is respected: no code shared between
apps/api(Python) andapps/relay(Rust) — only the money math (ADR-0001) and Neon/Cloudflare infra. Vend's contract between the two planes is HTTP + AITP-402, not a shared lib.
From Mint apps/mint + AITP-402 — the settlement layer & the moat
Every metered charge in Vend settles as an AITP-402 op producing a
hash-linked Receipt (mint-receipts). Concretely:
aitp-holdscheme (hold.create→ serve →hold.captureactual usage on success /hold.releaseon failure) is exactly success-only metered inference. A Vend request = a 402 challenge (price for this call) → signed authorization → hold → serve → capture. This is already specified in AITP-402 §5.stream.open/stream.tick/stream.closemeter token-streaming responses per-token against a reservedcap.allowance.grant/allowance.spendmodel a tenant granting each end-user (or agent) a delegated spend budget — the per-seat metering vertical apps want.transfer+ creator/provider payouts route the tenant's margin and provider cost as double-entry moves; the tenant's take-rate is atransferto their treasury account (type=1 org/5 treasury).- Reserve ledger (
mint-reserve) — every AIT (=$1 prepaid) an end-user tops up is 1:1 reserve-backed;Σ balances + Σ holds == reserveis enforced. This is the "reserve-backed wallet" in the product name and the solvency proof Vend shows enterprise tenants. - Receipts /
GET /v1/receipts/audit(merkle root) +GET /v1/reserve— give each tenant a verifiable, exportable ledger for their own finance/reconciliation. This is the switching-cost anchor: their books are keyed to Vend receipts.
Net: Vend is the product skin + multi-tenant control plane over gateway (routing), wallet (money), and Mint (settlement) — three things that exist. The new build is tenancy, onboarding, the top-up page, dunning, and the SDK.
6. Architecture sketch (prose + text diagram)
Planes
- Control plane (Python,
apps/apilineage): tenants, apps, keys, markup/cap policy, wallet balances, Stripe top-ups, dunning, usage rollups, receipts view. - Data plane (Rust,
apps/relaylineage): the OpenAI-compatible inference endpoint, provider routing + failover, per-request cost capture. - Settlement plane (Rust,
apps/mintlineage): AITP-402 verify/hold/capture, double-entry ledger, reserve conservation, hash-linked receipts. - Edge: the Vend SDK (thin, multi-language) + a hosted white-label top-up page.
Request lifecycle (metered, success-only)
End-user of Tenant-App
│ chat/completions call (via Vend SDK, tenant + end-user key)
▼
┌─────────────────────────────────────────────────────────────┐
│ VEND DATA PLANE (Relay-derived, OpenAI-compatible) │
│ 1. resolve tenant + app + end-user key │
│ 2. price this call → AITP-402 challenge (aitp-hold) │
│ 3. authorize: SETTLEMENT verifies sig, creates HOLD │◄─┐
│ 4. route to best provider (order/sort, allow_fallbacks) │ │
│ 5. on provider failure → failover to next; never bill │ │
│ 6. capture EXACT cost + tenant markup on SUCCESS │ │
└───────┬───────────────────────────────────┬─────────────────┘ │
│ exact base cost (Cost API) │ hold/capture/release │
▼ ▼ │
┌────────────────────┐ ┌──────────────────────────────┐│
│ VEND CONTROL PLANE │ │ VEND SETTLEMENT (Mint/AITP) ││
│ gateway.provisioning│ │ hold.create/capture/release ││
│ markup + daily cap │◄──markup──│ transfer(margin→tenant treas.)│┘
│ wallet ledger (µ$) │ │ stream.tick (streaming) │
│ Stripe top-ups + │ │ reserve: Σbal+Σholds==reserve │
│ dunning + invoices │ │ hash-linked RECEIPT per op │
│ usage rollups │ │ GET /reserve GET /audit(merkle)
└─────────┬──────────┘ └──────────────────────────────┘
│ balance low → auto top-up / dunning retry
▼
Hosted white-label TOP-UP PAGE (end-users buy AIT credit under tenant brand)
Tenancy model
Tenant(the AI-SaaS customer) → manyApps→ manyend-user keys.- Policy is per-tenant-and-app:
MarkupPolicy(their take-rate),ProvisioningKeydaily caps, allowed model set, data-logging/ZDR flags. - Money: each end-user has an AIT balance (reserve-backed); each tenant has a treasury account their margin transfers accrue to; Vend has a platform treasury taking the platform fee.
Failure & correctness posture
- Success-only (ADR-0002): hold on start, capture on success, release on any failure/failover — the end-user never pays for a 500.
- Integer money (ADR-0001): all amounts
amount_microsend-to-end; the top-up page's$is display-only. - Idempotency/replay: AITP-402
nonce(single-use) +idempotency_keymake SDK retries safe no-ops returning the original receipt.
7. Monetization (fees / markup / take-rate settling on Mint)
Three stacked, reserve-backed revenue lines, all expressed as Mint ops:
- Platform take-rate on metered spend — Vend takes a small % (e.g. 5–15 bps to
low single-digit %, configurable via the versioned fee schedule already in
wallet/policy.py) of every successfully-captured inference charge. Realized as atransferfrom the settlement flow to Vend's platform treasury on eachhold.capture. - Top-up fee — the existing wallet fee schedule (
_DEFAULT_FEE_RATE_BPS,_DEFAULT_MIN_FEE_MICROS) applies when end-users load AIT credit via the hosted page (Stripe or Web3 on-ramp). Reserve-gatedmintop. - BYOK / plan fees — a % fee on BYOK usage (Relay already models this) and seat/plan fees for larger tenants (SSO, custom domains, higher rate limits, solvency reports).
The tenant sets their own markup (MarkupPolicy.markup_bps) on top of base
provider cost; Vend takes a slice of the resulting margin. Because everything
clears through Mint, the platform take is a ledger entry, not a spreadsheet — it is
auditable and reserve-conserving by construction. Take-rate compounds: as a
tenant's users grow, spend grows, and Vend's cut grows without new sales.
Unit economics illustration (µ$, no floats):
base_cost=4_200µ$ → tenant markup 20% → end-user pays 5_040µ$ → tenant margin
840µ$ → Vend platform fee (say 5%) ~252µ$ transferred to platform treasury;
remainder to tenant treasury; provider paid 4_200µ$. All four moves are
double-entry ops with receipts.
8. Moat & network effects (the billion-dollar wedge)
Switching cost (medium-high, compounding)
- Billing rip-outs are the most-avoided migration. Once a tenant's end-users hold prepaid AIT balances and the tenant's finance reconciles against Vend receipts + reserve proof, leaving means migrating live balances, re-issuing keys, and re-implementing metering — a quarter of eng risk for zero user value.
- The reserve ledger is the record of truth, not a cache. Competitors can copy a gateway in a weekend; they cannot retroactively become your customers' ledger-of-record.
Network effects
- Every customer is a distribution channel for AITP-402. Each app that adopts
Vend seeds the payment standard among its users and, crucially, its agents.
As AITP-402 endpoints proliferate, an agent funded in one Vend-app's wallet can
pay any AITP-402 resource (cross-app
allowance/transfer), creating a two-sided rail: apps (demand for metered inference) and providers/agents (supply paid via the same receipts). - Marketplaces settle on the rail. Models, compute (RunPod GPU), creator payouts (ReelForge clipmarket), and agents can all clear through the same Mint ledger. The more that settles on it, the more valuable the reserve/receipt layer, and the higher the cost of running a parallel ledger.
The billion-dollar thesis
Gateway revenue caps out at "a % of inference we proxy." The durable platform value is being the payments rail for the agent economy — Mint + AITP-402 — with Vend as the wedge that installs that rail under thousands of apps. Vend's job is distribution: convert every AI-SaaS into a settlement endpoint. The company that owns the reserve-backed ledger under the agent economy owns metered-AI billing the way Stripe owns card billing. Vend is the fastest, cheapest way to seed that ledger, because the product founders already want (a resellable metered SDK) is the onboarding funnel for the rail.
Moat risks
Medium-high, not fortress. Weaker if OpenRouter/Portkey ship white-label, reserve-backed wallets your customers top up under their brand. Mitigation: win the wallet/receipt/reserve layer (hard to copy) fast, before the gateway incumbents add wallets; make the ledger the switching cost, not the gateway.
9. GTM — first 100 users
Self-serve, developer-led, single-buyer. No enterprise sales for the first 100.
- Design partners (users 1–5): hand-install the Vend SDK into 3–5 seed vertical-AI apps already running a homemade proxy. Free platform fee for 90 days in exchange for logo + case study + brutal feedback. Success = they delete their proxy.
- Templated self-serve (6–40): publish the "resellable AI SDK in an afternoon" quickstart + hosted top-up page. Distribute where AI founders live: relevant Discords/Slacks, Show HN, indie-hacker + AI-eng newsletters, "how we do metered AI billing" teardown blog posts. The demo is the pitch: live metered, marked-up, successfully-billed request on stage.
- Wedge-adjacent expansion (41–100): target the same shape (AI writing/coding/ analysis resellers), then adjacent (AI SDR, AI support, vertical copilots). Lean on the ReelForge family for warm intros — ReelForge's own gateway/reseller users are pre-qualified.
- Growth loops: (a) the hosted top-up page is Vend-branded-optional → "powered by Vend" seeds discovery; (b) receipts/reserve proofs are shareable solvency artifacts; (c) each agent funded on the rail is a new AITP-402 payer.
Positioning: not "another gateway" — "the metered wallet under your AI app." Land on billing pain (dunning, charging-on-failure, float bugs), not on model routing.
10. Key risks + kill-criteria
| # | Risk | Signal to watch | Kill / pivot criterion |
|---|---|---|---|
| R1 | Incumbent adds white-label wallets (OpenRouter/Portkey). | Competitor ships reserve-backed tenant wallets. | If they ship first and match reserve proof before we have 25 paying tenants, pivot to pure settlement/receipt layer (Mint-as-a-service) rather than gateway. |
| R2 | Founders tolerate homemade billing — pain not acute enough to switch. | Design partners don't delete their proxy after 60 days. | If <2 of 5 design partners fully cut over, the wedge isn't sharp — stop, re-interview, narrow further. |
| R3 | Reserve/custody & regulatory — holding prepaid balances looks like money transmission. | Legal review flags MTL/e-money exposure. | Keep strictly closed-loop, redeemable-1:1, non-tradeable (per AITP spec §1); if a jurisdiction forces licensing before revenue, gate top-ups to that region and continue elsewhere. Kill if custody cost > take-rate at target scale. |
| R4 | Take-rate too thin to matter — inference margins compress. | Blended platform take < infra + support cost per tenant. | If contribution margin per active tenant is negative at 20-tenant scale with no path to positive, kill. |
| R5 | Multi-tenant blast radius — one tenant's bug/fraud drains a shared reserve. | Any cross-tenant balance leak in property tests. | Non-negotiable: per-tenant reserve segregation + Mint conservation property tests must pass before onboarding paying tenants. Ship-blocker, not a kill. |
| R6 | Two-language operational drag (Python control plane + Rust data/settlement). | Deploy/oncall overhead dominates a tiny team. | If integration cost outweighs reuse benefit, consolidate the data plane onto whichever plane already carries the ledger. |
11. Phased roadmap (S×0 → S×4 with acceptance gates)
Each gate is a hard go/no-go. Amounts and money paths reuse existing ADR-0001/0002 guarantees, so gates focus on tenancy and settlement wiring, not money math.
-
Sx0 — Multi-tenant spike (internal). Add a
Tenantboundary overgateway+wallet; scope keystenant→app→end-user; per-tenantMarkupPolicy+ daily cap. Gate: two isolated tenants can mint keys, meter a mock charge with distinct markups, and their usage/balances never cross. Conservation property test green. -
Sx1 — Real metered request through all three planes. Wire data plane (Relay endpoint) → AITP-402
aitp-hold→hold.captureon success /hold.releaseon failure → receipt. One real provider. Gate: a livechat/completionscall is priced, held, served, captured at exact cost + tenant markup, and produces a valid hash-linked receipt; a forced provider failure bills the end-user nothing (ADR-0002 verified end-to-end). -
Sx2 — Hosted top-up page + Stripe + dunning. White-label top-up page →
mint(reserve-gated) on confirmed deposit; auto-top-up threshold; dunning (retry failed cards, notify, soft-limit). Gate: an end-user tops up under a tenant's brand, balance updates µ$-exact, reserve conservation holds (Σbal+Σholds==reserve), and a failed recharge runs the dunning sequence without double-charging or charging-on-failure. -
Sx3 — SDK + self-serve onboarding + failover/routing. Ship the thin multi-language SDK; self-serve tenant signup; provider routing with
allow_fallbacks/sort; per-tenant model allowlist + ZDR flags. Gate: a brand-new developer goes from signup to a metered, marked-up, successfully-billed request in under one afternoon with no manual setup; provider failover reroutes transparently with no erroneous charge. -
Sx4 — Design-partner GA + platform take + solvency proof. Turn on platform take-rate
transfer; expose per-tenant receipts export +GET /reservesolvency report; onboard the first paying design partners. Gate: ≥3 paying tenants live, platform take accrues to platform treasury as auditable ledger entries, each tenant can export a verifiable receipt log + reserve proof, and at least one design partner has deleted their old proxy.
12. Success metrics
North star: reserve-backed AIT spend settled through Vend per month (total metered inference $ clearing the rail) — it captures gateway usage, wallet top-ups, and take-rate in one number and is the leading indicator of the payments-rail thesis.
Supporting:
- Time-to-first-metered-request (target: < 1 afternoon; ideally < 30 min).
- Design-partner cutover rate (proxies deleted / design partners) — wedge-sharpness proof.
- Net revenue retention per tenant (take-rate compounding as their users grow) — target > 120%.
- Reserve-conservation integrity (must be 100%:
Σbal+Σholds==reservealways). - Success-only correctness (0 charges on failed generations).
- Platform contribution margin per active tenant (path to positive by Sx4 kill-gate).
- AITP-402 endpoints seeded (# of apps + agents transacting on the rail) — the network-effect / billion-dollar leading indicator.
13. Summary
Vend productizes infra that already ships (ReelForge gateway+wallet, Relay,
Mint/AITP-402) into a multi-tenant, white-label metered-billing platform. The wedge
is a resellable AI SDK a founder installs in an afternoon; the moat is the
reserve-backed wallet + receipt ledger that becomes their record-of-truth; the
prize is seeding AITP-402 as the payments rail for the agent economy, one AI-SaaS
customer-turned-distribution-channel at a time.