kiro.rs  by hank9999

Rust proxy for Anthropic Claude API compatibility

Created 2 months ago
649 stars

Top 51.4% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides a Rust-based proxy service that translates Anthropic Claude API requests into Kiro API requests. It targets developers and researchers needing to leverage Anthropic's powerful language models through a Kiro-compatible interface, offering enhanced features like streaming, robust credential management, and advanced model capabilities. The primary benefit is enabling seamless integration with Anthropic's offerings via a familiar Kiro API structure.

How It Works

The core of kiro.rs is a high-performance Rust application built with the Axum web framework and Tokio runtime. It acts as an intermediary, receiving requests formatted for the Anthropic API and converting them into requests compatible with the Kiro API. Key architectural choices include automatic OAuth token management with refresh capabilities, support for Server-Sent Events (SSE) for streaming responses, and intelligent retry mechanisms. The design prioritizes flexibility, allowing for multiple credential configurations for failover and automatic token write-back, alongside support for advanced Claude features like "thinking" mode and tool/function calling.

Quick Start & Requirements

  1. Build Frontend: Navigate to admin-ui and run npm install && npm run build.
  2. Compile Project: Execute cargo build --release.
  3. Configuration: Create a config.json file specifying host, port, apiKey, and region. A minimal configuration requires these four fields.
  4. Credentials: Create a credentials.json file. This can be a single credential object (with refreshToken, expiresAt, authMethod) or an array of objects for multi-credential support, including optional priority, clientId, clientSecret, and region fields.
  5. Run Service: Execute ./target/release/kiro-rs or specify configuration paths using -c and --credentials flags.
    • Prerequisites: Rust toolchain, Node.js/npm for frontend build.
    • Dependencies: None explicitly listed beyond Rust's ecosystem, but HTTP/SOCKS5 proxy support is configurable.

Highlighted Details

  • Anthropic API Compatibility: Fully supports Anthropic Claude API formats, including /v1/models, /v1/messages, and /v1/messages/count_tokens endpoints.
  • Streaming Responses: Implements SSE for real-time, streamed output.
  • Token Management: Features automatic OAuth token refresh and management, with support for multiple credentials and automatic failover.
  • Advanced Features: Includes support for Claude's "extended thinking" mode and comprehensive function calling/tool use capabilities.
  • Model Support: Works with Sonnet, Opus, and Haiku model series.
  • Intelligent Retries: Implements robust retry logic (up to 3 per credential, 9 per request).

Maintenance & Community

No specific details regarding maintainers, community channels (like Discord or Slack), or project roadmap were found in the provided text.

Licensing & Compatibility

The project is licensed under the MIT license, which is permissive for commercial use and integration. However, a strong disclaimer states the project is "for research use only, Use at your own risk," and the user assumes all consequences.

Limitations & Caveats

The project is explicitly designated for research purposes only and carries a "use at your own risk" disclaimer. Users may need to install specific certificates for HTTP PROXY features due to a switch in the TLS library (native-tls to rustls). Certain tools like web_search are intentionally filtered out and unsupported. Users must ensure the security of their credentials.json file, as it contains sensitive tokens.

Health Check
Last Commit

2 days ago

Responsiveness

Inactive

Pull Requests (30d)
26
Issues (30d)
35
Star History
289 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.