{"id":29806325,"url":"https://github.com/luohy15/y-router","last_synced_at":"2025-07-28T14:08:06.506Z","repository":{"id":304374699,"uuid":"1018582806","full_name":"luohy15/y-router","owner":"luohy15","description":"A Simple Proxy enabling Claude Code to work with OpenRouter","archived":false,"fork":false,"pushed_at":"2025-07-12T18:14:07.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-12T18:41:37.417Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://cc.yovy.app/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luohy15.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-12T15:17:31.000Z","updated_at":"2025-07-12T18:14:11.000Z","dependencies_parsed_at":"2025-07-12T18:53:42.351Z","dependency_job_id":null,"html_url":"https://github.com/luohy15/y-router","commit_stats":null,"previous_names":["luohy15/y-router"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/luohy15/y-router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luohy15%2Fy-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luohy15%2Fy-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luohy15%2Fy-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luohy15%2Fy-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luohy15","download_url":"https://codeload.github.com/luohy15/y-router/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luohy15%2Fy-router/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267527835,"owners_count":24102019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-28T14:05:57.229Z","updated_at":"2025-07-28T14:08:06.497Z","avatar_url":"https://github.com/luohy15.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Proxies \u0026 Model Integrations","代理与API工具"],"sub_categories":[],"readme":"# y-router\n\nA Cloudflare Worker that translates between Anthropic's Claude API and OpenAI-compatible APIs, enabling you to use Claude Code with OpenRouter and other OpenAI-compatible providers.\n\n## Quick Usage\n\n### One-line Install (Recommended)\n```bash\nbash -c \"$(curl -fsSL https://cc.yovy.app/install.sh)\"\n```\n\nThis script will automatically:\n- Install Node.js (if needed)\n- Install Claude Code\n- Configure your environment with OpenRouter or Moonshot\n- Set up all necessary environment variables\n\n### Manual Setup\n\n**Step 1:** Install Claude Code\n```bash\nnpm install -g @anthropic-ai/claude-code\n```\n\n**Step 2:** Get OpenRouter API key from [openrouter.ai](https://openrouter.ai)\n\n**Step 3:** Configure environment variables in your shell config (`~/.bashrc` or `~/.zshrc`):\n\n```bash\n# For quick testing, you can use our shared instance. For daily use, deploy your own instance for better reliability.\nexport ANTHROPIC_BASE_URL=\"https://cc.yovy.app\"\nexport ANTHROPIC_API_KEY=\"your-openrouter-api-key\"\n```\n\n**Optional:** Configure specific models (browse models at [openrouter.ai/models](https://openrouter.ai/models)):\n```bash\nexport ANTHROPIC_MODEL=\"moonshotai/kimi-k2\"\nexport ANTHROPIC_SMALL_FAST_MODEL=\"google/gemini-2.5-flash\"\n```\n\n**Step 4:** Reload your shell and run Claude Code:\n```bash\nsource ~/.bashrc\nclaude\n```\n\nThat's it! Claude Code will now use OpenRouter's models through y-router.\n\n### Multiple Configurations\n\nTo maintain multiple Claude Code configurations for different providers or models, use shell aliases:\n\n```bash\n# Example aliases for different configurations\nalias c1='ANTHROPIC_BASE_URL=\"https://cc.yovy.app\" ANTHROPIC_API_KEY=\"your-openrouter-key\" ANTHROPIC_MODEL=\"moonshotai/kimi-k2\" ANTHROPIC_SMALL_FAST_MODEL=\"google/gemini-2.5-flash\" claude'\nalias c2='ANTHROPIC_BASE_URL=\"https://api.moonshot.ai/anthropic/\" ANTHROPIC_API_KEY=\"your-moonshot-key\" ANTHROPIC_MODEL=\"kimi-k2-0711-preview\" ANTHROPIC_SMALL_FAST_MODEL=\"moonshot-v1-8k\" claude'\n```\n\nAdd these aliases to your shell config file (`~/.bashrc` or `~/.zshrc`), then use `c1` or `c2` to switch between configurations.\n\n## GitHub Actions Usage\n\nTo use Claude Code in GitHub Actions workflows, add the environment variable to your workflow:\n\n```yaml\nenv:\n  ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }}\n```\n\nSet `ANTHROPIC_BASE_URL` to `https://cc.yovy.app` in your repository secrets.\n\nExample workflows:\n- [Interactive Claude Code](.github/workflows/claude.yml) - Responds to @claude mentions\n- [Automated Code Review](.github/workflows/claude-code-review.yml) - Automatic PR reviews\n\n## What it does\n\ny-router acts as a translation layer that:\n- Accepts requests in Anthropic's API format (`/v1/messages`)\n- Converts them to OpenAI's chat completions format\n- Forwards to OpenRouter (or any OpenAI-compatible API)\n- Translates the response back to Anthropic's format\n- Supports both streaming and non-streaming responses\n\n## Perfect for Claude Code + OpenRouter\n\nThis allows you to use [Claude Code](https://claude.ai/code) with OpenRouter's vast selection of models by:\n1. Pointing Claude Code to your y-router deployment\n2. Using your OpenRouter API key\n3. Accessing Claude models available on OpenRouter through Claude Code's interface\n\n## Setup\n\n1. **Clone and deploy:**\n   ```bash\n   git clone \u003crepo\u003e\n   cd y-router\n   npm install -g wrangler\n   wrangler deploy\n   ```\n\n2. **Set environment variables:**\n   ```bash\n   # Optional: defaults to https://openrouter.ai/api/v1\n   wrangler secret put OPENROUTER_BASE_URL\n   ```\n\n3. **Configure Claude Code:**\n   - Set API endpoint to your deployed Worker URL\n   - Use your OpenRouter API key\n   - Enjoy access to Claude models via OpenRouter!\n\n## Environment Variables\n\n- `OPENROUTER_BASE_URL` (optional): Base URL for the target API. Defaults to `https://openrouter.ai/api/v1`\n\n## API Usage\n\nSend requests to `/v1/messages` using Anthropic's format:\n\n```bash\ncurl -X POST https://cc.yovy.app/v1/messages \\\n  -H \"Content-Type: application/json\" \\\n  -H \"x-api-key: your-openrouter-key\" \\\n  -d '{\n    \"model\": \"claude-sonnet-4-20250514\",\n    \"messages\": [{\"role\": \"user\", \"content\": \"Hello, Claude\"}],\n    \"max_tokens\": 100\n  }'\n```\n\n## Development\n\n```bash\nnpm run dev    # Start development server\nnpm run deploy # Deploy to Cloudflare Workers\n```\n\n## Thanks\n\nSpecial thanks to these projects that inspired y-router:\n- [claude-code-router](https://github.com/musistudio/claude-code-router)\n- [claude-code-proxy](https://github.com/kiyo-e/claude-code-proxy)\n\n## Disclaimer\n\n**Important Legal Notice:**\n\n- **Third-party Tool**: y-router is an independent, unofficial tool and is not affiliated with, endorsed by, or supported by Anthropic PBC, OpenAI, or OpenRouter\n- **Service Terms**: Users are responsible for ensuring compliance with the Terms of Service of all involved parties (Anthropic, OpenRouter, and any other API providers)\n- **API Key Responsibility**: Users must use their own valid API keys and are solely responsible for any usage, costs, or violations associated with those keys\n- **No Warranty**: This software is provided \"as is\" without any warranties. The authors are not responsible for any damages, service interruptions, or legal issues arising from its use\n- **Data Privacy**: While y-router does not intentionally store user data, users should review the privacy policies of all connected services\n- **Compliance**: Users are responsible for ensuring their use complies with applicable laws and regulations in their jurisdiction\n- **Commercial Use**: Any commercial use should be carefully evaluated against relevant terms of service and licensing requirements\n\n**Use at your own risk and discretion.**\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluohy15%2Fy-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluohy15%2Fy-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluohy15%2Fy-router/lists"}