y-router  by luohy15

API proxy for Claude Code

Created 2 months ago
278 stars

Top 93.4% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides a Cloudflare Worker that acts as a proxy, translating requests between Anthropic's Claude API format and OpenAI-compatible APIs. It enables users to leverage Claude Code with services like OpenRouter, offering access to a wider range of models through a familiar interface. The primary benefit is enhanced flexibility and model choice for users of Claude Code.

How It Works

The y-router worker intercepts API requests made in Anthropic's /v1/messages format. It then converts these requests into the OpenAI chat completions format, forwards them to a specified OpenAI-compatible API endpoint (defaulting to OpenRouter), and translates the response back into Anthropic's format. This two-way translation supports both streaming and non-streaming responses, abstracting the underlying API differences.

Quick Start & Requirements

  • One-line Install: bash -c "$(curl -fsSL https://cc.yovy.app/install.sh)"
  • Prerequisites: Node.js, npm (for manual setup), wrangler (for Cloudflare deployment), Docker (for local deployment).
  • Configuration: Requires an OpenRouter API key. Optional environment variables include ANTHROPIC_MODEL and ANTHROPIC_SMALL_FAST_MODEL for specifying preferred models.
  • Links: Claude Code, OpenRouter

Highlighted Details

  • Supports both streaming and non-streaming responses.
  • Allows configuration of multiple API endpoints and models via shell aliases for flexible switching.
  • Provides GitHub Actions examples for integrating into CI/CD workflows.
  • Offers Docker and Cloudflare Workers deployment options.

Maintenance & Community

The project is maintained by luohy15. It acknowledges inspiration from claude-code-router and claude-code-proxy. Community interaction channels are not explicitly mentioned in the README.

Licensing & Compatibility

  • License: MIT
  • Compatibility: The MIT license generally permits commercial use and linking with closed-source projects. However, the project's disclaimer strongly advises users to ensure compliance with the Terms of Service of Anthropic, OpenRouter, and any other API providers used.

Limitations & Caveats

The project is positioned as a tool for testing models other than Anthropic's native offerings, with a recommendation to use claude-relay-service for intensive usage of Anthropic models. Users are solely responsible for API key management, associated costs, and compliance with all relevant terms of service and legal regulations. The software is provided "as is" without warranty.

Health Check
Last Commit

1 month ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
1
Star History
46 stars in the last 30 days

Explore Similar Projects

Starred by Tobi Lutke Tobi Lutke(Cofounder of Shopify), Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), and
24 more.

open-webui by open-webui

0.6%
110k
Self-hosted AI platform for local LLM deployment
Created 1 year ago
Updated 1 day ago
Feedback? Help us improve.