Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Smart LLM router for autonomous agents. <!-- br:models.chatVisible -->90<!-- /br:models.chatVisible --> models. Two ways to pay:

- **Wallet (default)** — x402 USDC micropayments signed per call, against `blockrun.ai/api` (Base) or `sol.blockrun.ai/api` (Solana). New installs default to Solana.
- **Wallet (default)** — x402 USDC micropayments signed per call, against `blockrun.ai/api` (Base), `sol.blockrun.ai/api` (Solana) or `arc.blockrun.ai/api` (Circle's Arc, same EVM key as Base). New installs default to Solana. Per-chain facts (gateway, label, CAIP-2) live in `src/payment-chain.ts`.
- **API key** — `brk_live_…` from [user.blockrun.ai](https://user.blockrun.ai), billed against card-funded account credit, against `api.blockrun.ai`. `src/api-key.ts` resolves it (env → `~/.blockrun/.api-key` → `~/.openclaw/blockrun/api-key`); a key present anywhere wins over a wallet, and no wallet is generated or read in that mode.

## Commands
Expand Down
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ Full walkthrough: [Paying with a credit card](#paying-with-a-credit-card-api-key

**Two ways to pay for the paid ones — pick one, the rest of ClawRouter is identical:**

| | Wallet (default) | API key |
| ----------------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| **Who it is for** | Autonomous agents, and anyone happy holding USDC | People who would rather pay with a card |
| **Setup** | Nothing — a wallet is generated on first run | Sign up at [user.blockrun.ai](https://user.blockrun.ai), top up, mint a key, `clawrouter login brk_live_…` |
| **Auth** | An x402 signature per request | `Authorization: Bearer brk_live_…` |
| **Gateway** | `sol.blockrun.ai` (Solana, default) / `blockrun.ai` (Base) | `api.blockrun.ai` |
| **Billing** | USDC leaves your wallet per call, non-custodial | Card-funded account credit, drawn down at exact usage |
| **Fees** | $0.001/tx settlement fee (covers on-chain gas) | 5.5% + $0.30 on the top-up, then list price with **nothing per call** |
| | Wallet (default) | API key |
| ----------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| **Who it is for** | Autonomous agents, and anyone happy holding USDC | People who would rather pay with a card |
| **Setup** | Nothing — a wallet is generated on first run | Sign up at [user.blockrun.ai](https://user.blockrun.ai), top up, mint a key, `clawrouter login brk_live_…` |
| **Auth** | An x402 signature per request | `Authorization: Bearer brk_live_…` |
| **Gateway** | `sol.blockrun.ai` (Solana, default) / `blockrun.ai` (Base) / `arc.blockrun.ai` (Arc) | `api.blockrun.ai` |
| **Billing** | USDC leaves your wallet per call, non-custodial | Card-funded account credit, drawn down at exact usage |
| **Fees** | $0.001/tx settlement fee (covers on-chain gas) | 5.5% + $0.30 on the top-up, then list price with **nothing per call** |

ClawRouter prefers the API key whenever one is configured, so `clawrouter login`
is all it takes to switch and `clawrouter logout` is all it takes to switch back.
Expand Down Expand Up @@ -583,12 +583,15 @@ USDC stays in your wallet until spent — non-custodial. Price is visible in the

**Dual-chain support:** Pay with **USDC on Solana** (the default) or **USDC on Base (EVM)**. Both wallets are derived from a single BIP-39 mnemonic on first run. New installs get **Solana**; an install that predates the Solana default keeps its **Base** wallet — its USDC is there — until you switch with `/wallet solana`.

**Arc:** you can also pay with **USDC on [Circle's Arc](https://arc.network)** (`eip155:5042`) via `arc.blockrun.ai` — same models, same prices, same $0.001 per-call fee as Base. Arc uses the **same EVM key and address as Base**, so there is nothing new to back up: switch with `/wallet arc` (or `clawrouter chain arc`) and fund that address with USDC on Arc.

```bash
/wallet # Check balance and address (both chains)
/wallet export # Export mnemonic + keys for backup
/wallet recover # Restore wallet from mnemonic on a new machine
/wallet solana # Switch to Solana USDC payments
/wallet base # Switch to Base (EVM) USDC payments
/wallet arc # Switch to Arc (EVM) USDC payments — same address as Base
/stats # View usage and savings
/stats clear # Reset usage statistics
/exclude # Show excluded models
Expand All @@ -601,6 +604,7 @@ USDC stays in your wallet until spent — non-custodial. Price is visible in the

- **Solana (default):** Send USDC on Solana to your Solana address
- **Base (EVM):** Send USDC on Base to your EVM address
- **Arc (EVM):** Send USDC on Arc to the same EVM address
- **Coinbase/CEX:** Withdraw USDC to either network
- **Credit card:** don't fund a wallet at all — [sign up at user.blockrun.ai](https://user.blockrun.ai) and use an API key instead (below)

Expand Down
5 changes: 5 additions & 0 deletions apps/desktop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ ClawRouter wallet under `~/.openclaw/blockrun/` is copied into the corresponding
Core files only when those files do not already exist. The legacy files are
retained for rollback; Desktop never overwrites an existing Core wallet.

Payment chains are Base, Solana and Circle's Arc — Desktop takes the list from
ClawRouter's own table (`src/payment-chain.ts`) rather than defining its own.
Arc pays from the same EVM key and address as Base (`~/.blockrun/.session`);
its USDC balance is read from `https://arc.blockrun.ai/api/v1/balance`.

## One-click contract

Every adapter follows the same transaction:
Expand Down
41 changes: 41 additions & 0 deletions apps/desktop/electron/core/chains.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Desktop's view of the payment chains. The chain list, labels and type are
* NOT redefined here: they come from ClawRouter's own table
* (src/payment-chain.ts), the same one the CLI and proxy use, so a chain the
* proxy can pay on cannot be missing from Desktop. Imported by both the
* Electron main process and the renderer; keep it free of Node imports.
*/
import {
PAYMENT_CHAINS,
PAYMENT_CHAIN_LABELS,
isPaymentChain,
type PaymentChain,
} from "../../../../src/payment-chain.js";

export { PAYMENT_CHAINS, PAYMENT_CHAIN_LABELS, isPaymentChain };
export type { PaymentChain };

/**
* Which Core wallet pays on a chain. Base and Arc are both EVM and share ONE
* key (~/.blockrun/.session) and address; Solana has its own
* (~/.blockrun/.solana-session).
*/
export type WalletKind = "evm" | "solana";

export function walletKindOf(chain: PaymentChain): WalletKind {
return chain === "solana" ? "solana" : "evm";
}

/** The Core wallet file a chain's key lives in. */
export function coreWalletFileOf(chain: PaymentChain): ".session" | ".solana-session" {
return walletKindOf(chain) === "evm" ? ".session" : ".solana-session";
}

export function chainLabel(chain: PaymentChain): string {
return PAYMENT_CHAIN_LABELS[chain];
}

/** A chain from /health or a chain file; anything unrecognised is undefined, not Base. */
export function paymentChainOrUndefined(value: unknown): PaymentChain | undefined {
return isPaymentChain(value) ? value : undefined;
}
3 changes: 2 additions & 1 deletion apps/desktop/electron/core/ipc-policy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { fileURLToPath } from "node:url";
import { resolve } from "node:path";

import { isPaymentChain } from "./chains.js";
import type { AgentId, InstallOptions, PaymentChain } from "./types.js";

const AGENT_IDS = new Set<AgentId>(["openclaw", "codex", "hermes", "dsh", "pi"]);
Expand Down Expand Up @@ -39,7 +40,7 @@ export function parseInstallOptions(value: unknown): InstallOptions {
}

export function parsePaymentChain(value: unknown): PaymentChain {
if (value !== "base" && value !== "solana") throw new Error("Unsupported payment chain");
if (!isPaymentChain(value)) throw new Error("Unsupported payment chain");
return value;
}

Expand Down
Loading
Loading