feat(agentswarm): M5 — x402 billing wrapper for the swarm route

withX402() wraps the Web handler so unpaid calls get a standard HTTP 402
challenge (x402Version + accepts[]) and paid calls fall through to the agent.
Payment verification is injectable (host wires CoinPay/x402); CORS preflight
passes through untouched; custom challenge responses supported. README documents
the optional c0mpute.com GPU backend.

4 new tests; 38/38 pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-06-25 17:48:12 +00:00
parent fbbb323477
commit 0e5a13f5fb
4 changed files with 137 additions and 0 deletions

View file

@ -89,6 +89,23 @@ const runner = createRubricRunner({
Pass the rubric per request: `{ "messages": [...], "rubric": "- one sentence\n- mentions chlorophyll" }`.
## Optional: run on community GPUs (c0mpute.com)
Inference is swappable. If a user connects their [c0mpute.com](https://c0mpute.com)
account (peer-shared GPUs), run agents/judges/routers on it instead of a hosted
provider. agentswarm does no OAuth — the host's c0mpute connector supplies the
credentials; this just consumes them:
```ts
import { createC0mputeModel, createDeepAgentRunner } from "@logicsrc/agentswarm";
// `connector` comes from the user connecting their c0mpute.com account
const model = await createC0mputeModel({ apiKey: connector.apiKey, model: "llama-3.1-70b" });
const runner = await createDeepAgentRunner({ model });
```
Opt-in: omit it and the default hosted provider is used. Requires `@langchain/openai`.
## Status
- **M1** ✓ core handler + injectable runner + deepagents adapter + x402 gate hook.