Discover and explore top open-source AI tools and projects—updated daily.
AkideLiuIntelligent Claude API gateway
Top 99.3% on SourcePulse
Summary
BetterClaude Gateway is an intelligent API proxy for Claude, built on Cloudflare Workers. It addresses the problem of corrupted message histories caused by orphaned tool_result blocks, which lead to 400 errors. By automatically cleaning these errors, it ensures seamless interaction with Claude's tool-calling capabilities, benefiting developers integrating AI agents.
How It Works
The gateway employs a proactive cleanup strategy, scanning messages for orphaned tool_result blocks before forwarding requests to the Claude API. If errors persist, it falls back to a reactive cleanup mechanism, parsing API responses to identify and remove remaining problematic blocks. This dual approach ensures robust error handling and maintains conversation integrity, preventing API failures due to malformed message histories.
Quick Start & Requirements
npm install.wrangler.jsonc with your worker name, domain routes, and zone name.npm run deploy to deploy the worker.npm run dev for a local development server.https://<YOUR_DOMAIN>/claude/<TARGET_HOST>/v1/messages.Highlighted Details
tool_result blocks that cause 400 errors.Maintenance & Community
No specific details regarding maintainers, sponsorships, or community channels (like Discord/Slack) are provided in the README.
Licensing & Compatibility
The project is licensed under the MIT license. This permissive license generally allows for broad compatibility, including commercial use and integration into closed-source applications, without significant restrictions.
Limitations & Caveats
The proxy's effectiveness relies on the stability and error reporting format of the underlying Claude API. While it handles known orphaned tool_result errors, unforeseen API changes or other error types might require updates. The project is deployed as a Cloudflare Worker, necessitating adherence to Cloudflare's platform limitations and usage policies.
3 months ago
Inactive