Skip to content
Open
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
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,25 @@ For basic usage, no configuration needed. For advanced options:
| `CLAWROUTER_DISABLED` | `false` | Disable smart routing |
| `BLOCKRUN_PROXY_PORT` | `8402` | Proxy port |
| `BLOCKRUN_WALLET_KEY` | auto | Wallet private key |
| `BLOCKRUN_PAYMENT_MODE` | `wallet` | Payment backend: `wallet` or `clawcredit` |
| `CLAWCREDIT_API_TOKEN` | - | Required when `BLOCKRUN_PAYMENT_MODE=clawcredit` |
| `CLAWCREDIT_BASE_URL` | `https://api.claw.credit` | Claw Credit API base URL |
| `CLAWCREDIT_PAYMENT_CHAIN` | `BASE` | Chain passed to claw.credit `transaction.chain` |
| `CLAWCREDIT_PAYMENT_ASSET` | Base USDC | Asset passed to claw.credit `transaction.asset` |

To pay BlockRun inference via claw.credit instead of local wallet signing:

```bash
export BLOCKRUN_PAYMENT_MODE=clawcredit
export CLAWCREDIT_API_TOKEN=claw_xxx
```

OpenClaw automatically loads `~/.openclaw/.env` on startup. If you want a one-command setup (no manual `export`), run:

```bash
# Installs/enables the plugin (if needed), writes ~/.openclaw/.env, restarts gateway
bash ~/.openclaw/extensions/clawrouter/scripts/setup-clawcredit.sh
```

**Full reference:** [docs/configuration.md](docs/configuration.md)

Expand Down
7 changes: 7 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ Complete reference for ClawRouter configuration options.
| --------------------- | ------- | ------------------------------------------------------------------------ |
| `BLOCKRUN_WALLET_KEY` | - | Ethereum private key (hex, 0x-prefixed). Used if no saved wallet exists. |
| `BLOCKRUN_PROXY_PORT` | `8402` | Port for the local x402 proxy server. |
| `BLOCKRUN_PAYMENT_MODE` | `wallet` | Payment backend: `wallet` (local x402 signing) or `clawcredit` (claw.credit) |
| `CLAWCREDIT_API_TOKEN` | - | Required when `BLOCKRUN_PAYMENT_MODE=clawcredit` |
| `CLAWCREDIT_BASE_URL` | `https://api.claw.credit` | claw.credit API base URL |
| `CLAWCREDIT_PAYMENT_CHAIN` | `BASE` | Chain passed to claw.credit `transaction.chain` |
| `CLAWCREDIT_PAYMENT_ASSET` | Base USDC | Asset passed to claw.credit `transaction.asset` |

> **Tip:** OpenClaw loads environment variables from `~/.openclaw/.env` on startup. You can put the variables above there (or run `scripts/setup-clawcredit.sh`).

### BLOCKRUN_WALLET_KEY

Expand Down
5 changes: 5 additions & 0 deletions openclaw.plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"type": "string",
"description": "EVM wallet private key (0x...). Optional — auto-generated if not set."
},
"paymentMode": {
"type": "string",
"enum": ["wallet", "clawcredit"],
"description": "Payment backend. Defaults to wallet; set clawcredit to route payments via claw.credit."
},
"routing": {
"type": "object",
"description": "Override default routing configuration"
Expand Down
8 changes: 8 additions & 0 deletions openclaw.security.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
"justification": "ClawRouter uses this wallet key to sign USDC payment transactions on Base L2. The key is used LOCALLY for cryptographic signing and is NEVER transmitted over the network. This is required for x402 protocol compliance.",
"dataFlow": "local-only",
"networkTransmission": false
},
{
"type": "env-access",
"variable": "CLAWCREDIT_API_TOKEN",
"purpose": "authenticate claw.credit payment requests",
"justification": "When BLOCKRUN_PAYMENT_MODE=clawcredit is enabled, ClawRouter forwards payment authorization requests to claw.credit /v1/transaction/pay and must send this bearer token to authenticate the request.",
"dataFlow": "sent-to-claw-credit-api",
"networkTransmission": true
}
],
"securityNotes": [
Expand Down
51 changes: 28 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"url": "git+https://github.com/BlockRunAI/ClawRouter.git"
},
"dependencies": {
"@t54-labs/clawcredit-sdk": "^0.2.40",
"viem": "^2.39.3"
},
"peerDependencies": {
Expand Down
Loading