# ClawRouter

ClawRouter is BlockRun's smart LLM router for OpenClaw. It runs a local proxy on port 8402, classifies requests by complexity, and routes them to BlockRun's API using x402 USDC micropayments. It does not support custom backend providers without code changes, and it does not route to The Grid.

## Short answer

The Grid cannot plug into ClawRouter as a backend through configuration alone. ClawRouter's upstream API is hardcoded to BlockRun's endpoints, and its payment layer uses x402 micropayments that The Grid does not implement. If you want The Grid in OpenClaw, configure it as a separate provider alongside ClawRouter, or use Manifest as your router instead.

## Why ClawRouter is not a direct fit

Three things make ClawRouter incompatible with The Grid as a backend:

1. **Hardcoded upstream.** The proxy target (`BLOCKRUN_API` and `BLOCKRUN_SOLANA_API`) is a constant in `proxy.ts`, not a configurable env var. The `startProxy({ apiBase })` option exists in code but is not exposed to CLI or plugin config; it's used for testing.
2. **x402 payment protocol.** ClawRouter uses `@x402/fetch` to sign USDC micropayments for every request. The Grid uses standard API key authentication, not x402. Swapping this requires replacing the payment layer.
3. **BlockRun-specific model registry.** `BLOCKRUN_MODELS` in `models.ts` lists model IDs, pricing, and capabilities for BlockRun's catalog. Grid instruments are not in this registry and would have to be added manually.

## What works instead

| Approach                                  | Works? | Notes                                                |
| ----------------------------------------- | ------ | ---------------------------------------------------- |
| The Grid as a ClawRouter backend          | No     | Upstream is hardcoded to BlockRun + x402             |
| The Grid alongside ClawRouter in OpenClaw | Yes    | Separate provider, same config file, switch per task |
| The Grid through Manifest                 | Yes    | Manifest accepts custom OpenAI-compatible providers  |
| The Grid directly in OpenClaw             | Yes    | Simplest path, no router needed                      |

### Option 1: add The Grid as a parallel provider in OpenClaw (recommended)

Keep ClawRouter installed. Add The Grid directly to `openclaw.json` and switch per task with `/model thegrid/code-prime` or `/model blockrun/auto`. Full setup in [Use The Grid with OpenClaw](/docs/integrations-and-best-practices/integrations/openclaw.md). Instrument IDs live in the [current instruments list](/docs/instrument-specifications/current-instruments.md).

### Option 2: replace ClawRouter with Manifest

Uninstall ClawRouter, install Manifest, connect The Grid as a backend. You get tier-based routing without x402 or crypto wallets. See [Use The Grid with Manifest](/docs/integrations-and-best-practices/integrations/manifest.md).

### Option 3: skip the router entirely

If you don't need smart routing, add The Grid as a provider in `openclaw.json` and select instruments manually. The simplest path.

## When ClawRouter still makes sense

* You need x402 USDC payments (no credit card, no API key billing).
* You want ClawRouter's smart routing applied specifically to BlockRun's catalog.

For everything else, route OpenClaw to The Grid directly or through Manifest.

## Troubleshooting

{% hint style="info" %}
**Community fork (`cgaeking/ClawRouter`).** A fork removes x402 and uses direct API keys plus an OpenRouter fallback. It could in theory point to The Grid, but it's unverified and unsupported by either project.
{% endhint %}

{% hint style="info" %}
**`startProxy({ apiBase })` workaround.** Exists in code but is not exposed as an env var or plugin config. Even if you set it programmatically, The Grid does not implement x402, so the payment handshake fails.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://thegrid.ai/docs/integrations-and-best-practices/integrations/clawrouter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
