Search projects, hackathons, sponsors and tech

    ← All projects

    Resvary

    Resvary lets an AI agent buy document analysis with USDC-funded credits on Arc.

    Demo

    About

    Resvary is an open-source prepaid credit and usage ledger for AI products. This demo lets a visitor submit text to a buying agent. The agent checks the account balance and service quote. When credits run short, a Circle Agent Wallet pays a fixed Circle Gateway challenge in Testnet USDC on Arc. Resvary grants product credits, reserves the quoted cost, calls a separate document-analysis model, charges measured token usage, releases the unused reserve, and returns an auditable receipt. Replaying the same request returns the saved result and receipt without another model call or charge.

    How it's made

    I built the demo as a new Next.js 16 application in the Resvary TypeScript monorepo. OpenAI Agents SDK runs the buying loop with four fixed tools: check balance, get a quote, fund a shortfall, and execute the prepared analysis. The agent has no shell access. Server code fixes the Arc Testnet network, service URL, Circle Agent Wallet, Gateway payer, seller, amount, and spending limits. Vercel Workflow coordinates durable execution. Managed Neon PostgreSQL stores signed visitor sessions, jobs, input hashes, reservations, model results, usage, receipts, quotas, and the persistent demo budget. One database execution claim serializes paid work across Vercel instances. The service saves a model result before committing usage, so a commit retry does not call the model again. Unknown payment or provider outcomes stop for operator review. The reusable @resvary/circle package now exports createGatewayCreditGate. It attempts a credit reservation and creates a Circle Gateway top-up challenge when the account lacks credits. Circle CLI 1.0.0 controls the Testnet Agent Wallet. Gateway funds the credit ledger with USDC on Arc, after which the agent retries the reservation. Nous hosts qwen/qwen3.8-flash for the buying agent and openai/gpt-4.1-mini for the paid document analysis. Playwright, Vitest, deterministic providers, and a sanitized proof exporter cover the source and live paths.