-
Notifications
You must be signed in to change notification settings - Fork 212
feat: Local Claude CLI integration to skip x402 for Anthropic models #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Local Claude CLI integration to skip x402 for Anthropic models #15
Conversation
- Add localBackends config option in plugin settings - Create local-backend.ts with Claude CLI handler - Integrate local backend check in proxy before x402 flow - Update README with configuration documentation When enabled, Anthropic models (claude, sonnet, opus, haiku) are routed to the local Claude CLI instead of x402 payments. Useful for users with Claude Pro/Max subscriptions who want to use their existing auth. Other models (GPT, Gemini, Grok, etc.) continue through ClawRouter. Closes BlockRunAI#14
1b1ebfe to
40e53b3
Compare
The plugin config schema was missing the localBackends property, causing OpenClaw to reject the config key during validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
OpenClaw's plugin loader does not await async register() functions, and SIGUSR1 hot-reloads only call service stop()/start() without re-calling register(). Move proxy startup into the service start() callback so it survives hot-reloads. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude CLI doesn't support --max-tokens, causing it to exit immediately with an error. The subsequent stdin.write() then threw an unhandled EPIPE that crashed the entire gateway process. - Remove --max-tokens arg (not a valid Claude CLI flag) - Add stdin error handler to prevent EPIPE from crashing the gateway Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Hi @gigi-trifle, Thank you for taking the time to implement this feature! The code quality is solid and the approach is clever. However, after careful consideration, we've decided not to merge this PR. Let me explain why: Technical & Compliance Concerns1. Terms of Service Risk 2. Security Considerations
This increases ClawRouter's attack surface significantly. It's better to keep authentication at the OpenClaw layer where users have full control. 3. Maintenance & Scope Creep
This shifts ClawRouter's focus from "cost-optimized routing" to "subscription management platform." The Alternative: OpenClaw-Native ApproachOpenClaw already has a model failover system that solves this use case more elegantly: openclaw models set anthropic/claude-sonnet-4-5 # Primary (subscription)
openclaw models fallbacks add blockrun/auto # Failover (x402)Advantages over this PR:
Documentation Instead of CodeWe've created comprehensive documentation explaining how to set this up: This guide covers everything users need to achieve the same goal without the compliance/security risks. Feedback WelcomeWe really appreciate your contribution and the discussion it sparked! If you have thoughts on the OpenClaw-native approach or see gaps we haven't addressed, please share them here or in the original issue (#14). Thank you again for your interest in improving ClawRouter! Resources: |
Implement the feature from issue #14. Adds config option to route Anthropic models to local Claude CLI instance instead of x402 payments. Includes selector logic, proxy handler, and config injection. POC tested with basic requests. Closes #14.