Skip to main content

ClawRouter for Hermes — 55+ models, x402 USDC micropayments, smart routing

Project description

hermes-plugin-clawrouter

ClawRouter for Hermes — 55+ LLMs, x402 USDC micropayments, smart routing.

Wraps the existing ClawRouter TypeScript proxy as a Hermes plugin. Wallet (BIP-39, Base + Solana), routing (15-dimension scorer), and x402 payment all stay in the canonical TS implementation — this is a thin Python adapter.

Install

pip install hermes-plugin-clawrouter
hermes plugins enable clawrouter
hermes-clawrouter setup
hermes-clawrouter doctor

setup writes the model-provider plugin to ~/.hermes/plugins/model-providers/clawrouter/, seeds CLAWROUTER_API_KEY=clawrouter-local in ~/.hermes/.env, and registers ClawRouter in ~/.hermes/config.yaml so Hermes' /model picker can show the provider and curated BlockRun chat models.

CLAWROUTER_API_KEY is intentionally a non-secret placeholder. ClawRouter payments use the local wallet/proxy, but Hermes hides API-key-style providers from /model unless the configured key env var exists.

hermes-clawrouter is provided because some Hermes releases do not add plugin-defined top-level CLI commands before the plugin is enabled. Once the plugin is loaded, hermes clawrouter <setup|wallet|doctor|route|stats> may also be available.

Usage

In a Hermes chat:

  • Set model to blockrun/auto to use ClawRouter's smart routing.
  • /clawrouter wallet — address + USDC balance
  • /clawrouter stats — proxy usage stats
  • /clawrouter status — proxy health
  • /clawrouter route <eco|auto|premium> — switch routing profile

Tools (callable from chat):

  • clawrouter_image_generate — 55+ models incl. DALL-E 3, Flux, Nano Banana
  • clawrouter_video_generate — Seedance, Grok Imagine
  • clawrouter_web_search — Exa-powered

Auxiliary vision

Hermes' vision_analyze builds a separate OpenAI client for the configured auxiliary.vision provider. That path is fragile for remote custom endpoints (hermes-agent#38679: Connection error) and for OAuth providers (#38685: silent fallback to auto). Routing vision through ClawRouter sidesteps both — it's a single api_key provider on 127.0.0.1, so there's no OAuth branch to miss and no remote TLS handshake to mishandle. Add to ~/.hermes/config.yaml:

auxiliary:
  vision:
    provider: clawrouter
    model: blockrun/auto          # or google/gemini-2.5-pro, anthropic/claude-sonnet-4.6
    base_url: http://127.0.0.1:8402/v1
    api_key: clawrouter-local
    timeout: 120

setup does not write this automatically — it would overwrite an existing vision config — so add it by hand if you want vision through ClawRouter, then hermes gateway restart.

Wallet

The plugin reads the canonical wallet at ~/.openclaw/blockrun/mnemonic (24-word BIP-39 phrase, mode 0o600). To create one:

npx @blockrun/clawrouter setup

Then fund USDC on Base or Solana — $5 covers thousands of requests, non-custodial. The plugin never writes to the wallet.

Headless / CI

Set BLOCKRUN_WALLET_KEY=<0x raw EVM hex> to bypass the mnemonic file (EVM-only — Solana derivation unavailable).

Environment variables

Variable Effect
CLAWROUTER_PROXY_URL Point at an externally-managed proxy (e.g. https://my-host/v1). Skips local spawn entirely.
HERMES_CLAWROUTER_AUTOSPAWN=0 Disable lazy spawn; require npx @blockrun/clawrouter to be running already.
BLOCKRUN_WALLET_KEY Raw EVM hex private key — overrides the mnemonic file.
CLAWROUTER_ROUTING_PROFILE eco / auto / premium. Forwarded to the proxy on spawn.

How it works

  1. hermes starts → the entry-point plugin is loaded → register(ctx) wires tools, slash commands, CLI, and the skill.
  2. hermes-clawrouter setup materializes ~/.hermes/plugins/model-providers/clawrouter/{plugin.yaml,__init__.py} from bundled package data and writes Hermes config/env hints needed by current Hermes provider and gateway model-picker paths.
  3. Hermes' providers/__init__.py discovers the materialized directory and registers the ClawRouterProfile, pointing base_url at http://127.0.0.1:<port>/v1.
  4. First tool call or chat turn → the supervisor probes :8402, spawns npx -y @blockrun/clawrouter --port <port> if needed, waits ≤30s for /v1/models, then forwards the request.
  5. A heartbeat thread restarts the subprocess on death (max 3 restarts/min).

Distribution

The Python package ships both logical plugins:

  • Standalone plugin (this PyPI entry point): tools, slash commands, CLI, skill.
  • Model-provider plugin (materialized into ~/.hermes/plugins/model-providers/clawrouter/ by hermes clawrouter setup): ProviderProfile registration.

This split is required because Hermes' PluginManager (hermes_cli/plugins.py) skips register(ctx) for kind: model-provider, and entry-point plugins always load as kind: standalone.

Development

pip install -e ".[dev]"
pytest

License

MIT. © BlockRun.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hermes_plugin_clawrouter-0.3.4.tar.gz (41.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hermes_plugin_clawrouter-0.3.4-py3-none-any.whl (36.2 kB view details)

Uploaded Python 3

File details

Details for the file hermes_plugin_clawrouter-0.3.4.tar.gz.

File metadata

  • Download URL: hermes_plugin_clawrouter-0.3.4.tar.gz
  • Upload date:
  • Size: 41.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for hermes_plugin_clawrouter-0.3.4.tar.gz
Algorithm Hash digest
SHA256 1fcd7faee80a907b41afb952b261deca49bdb784b8bfc7fb8663510364b12053
MD5 855ada18c59b5f84c5a0d91766143dbe
BLAKE2b-256 64e0aa5b320b5383ceb933bf2f96b4c2e2724c7303633c35a3951eba1dc6e976

See more details on using hashes here.

File details

Details for the file hermes_plugin_clawrouter-0.3.4-py3-none-any.whl.

File metadata

File hashes

Hashes for hermes_plugin_clawrouter-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b4acc52cd2448254eae326f51dd740950837c7d7f3cacf3552628837ebe36345
MD5 0e3f870bbcdeb5ca3ed99ead9235a6ef
BLAKE2b-256 cc9957d6b2f4aa45934118c925016aa26da909b0b6c39745b14ebc101a7e5ec0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page