{"id":50308595,"url":"https://github.com/duyet/ccr","last_synced_at":"2026-05-28T18:30:53.927Z","repository":{"id":305071873,"uuid":"1021465990","full_name":"duyet/ccr","owner":"duyet","description":"Claude Code + Open Router","archived":false,"fork":false,"pushed_at":"2026-05-18T20:14:38.000Z","size":142,"stargazers_count":3,"open_issues_count":26,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-18T22:41:39.152Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ccr.duyet.workers.dev","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/duyet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-17T12:43:55.000Z","updated_at":"2026-01-19T11:28:47.000Z","dependencies_parsed_at":"2025-09-14T04:15:23.060Z","dependency_job_id":"850e531b-e20b-42ac-94bf-ba27757d35d3","html_url":"https://github.com/duyet/ccr","commit_stats":null,"previous_names":["duyet/ccr.duyet.net","duyet/ccr"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/duyet/ccr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duyet%2Fccr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duyet%2Fccr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duyet%2Fccr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duyet%2Fccr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/duyet","download_url":"https://codeload.github.com/duyet/ccr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duyet%2Fccr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33622066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"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":"2026-05-28T18:30:53.786Z","updated_at":"2026-05-28T18:30:53.909Z","avatar_url":"https://github.com/duyet.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CCR (Claude Code Router)\n\n\u003e **Built entirely with [Claude Code](https://claude.ai/code)** - An AI-powered development workflow\n\nA Cloudflare Worker proxy that enables **Claude Code** to access OpenRouter's diverse model selection. CCR acts as a translation layer between Anthropic's Claude API format and OpenAI-compatible APIs.\n\n## 🚀 What is CCR?\n\nThis Cloudflare Worker acts as a translation layer between Anthropic's Claude API format and OpenAI-compatible APIs, specifically OpenRouter. It allows **Claude Code** to access a wide range of models through OpenRouter while maintaining the familiar Claude API interface.\n\n**Key Features:**\n- 🔄 **API Translation**: Seamlessly converts between Anthropic and OpenAI API formats\n- 🌐 **OpenRouter Integration**: Access to multiple AI models through OpenRouter's unified API\n- ⚡ **Cloudflare Workers**: Fast, globally distributed proxy with minimal latency\n- 🎯 **Claude Code Compatible**: Designed specifically for Claude Code users\n\n## ⚡ Quick Start\n\n### 1. Set up Claude Code\nInstall Claude Code CLI:\n\n```bash\nnpm install -g @anthropic-ai/claude-code\n```\n\nFor more details, see: https://docs.anthropic.com/en/docs/claude-code/setup\n\n### 2. Get OpenRouter API Key\nSign up at [openrouter.ai](https://openrouter.ai) and get your API key\n\n### 3. Using Claude Code with CCR\n\n#### Basic Usage\n```bash\n# Use either ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN (both work the same way)\nANTHROPIC_BASE_URL=\"https://ccr.duyet.net\" ANTHROPIC_API_KEY=\"your-openrouter-api-key\" claude\nANTHROPIC_BASE_URL=\"https://ccr.duyet.net\" ANTHROPIC_AUTH_TOKEN=\"your-openrouter-api-key\" claude\n```\n\n#### With Custom Models\n```bash\n# Use either ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN with custom models\nANTHROPIC_BASE_URL=\"https://ccr.duyet.net\" ANTHROPIC_API_KEY=\"your-openrouter-api-key\" ANTHROPIC_MODEL=\"moonshotai/kimi-k2:free\" ANTHROPIC_SMALL_FAST_MODEL=\"google/gemini-2.5-flash\" claude\nANTHROPIC_BASE_URL=\"https://ccr.duyet.net\" ANTHROPIC_AUTH_TOKEN=\"your-openrouter-api-key\" ANTHROPIC_MODEL=\"moonshotai/kimi-k2:free\" ANTHROPIC_SMALL_FAST_MODEL=\"google/gemini-2.5-flash\" claude\n```\n\n#### Environment Setup (Optional)\nFor permanent setup, add to your shell profile:\n\n```bash\nexport ANTHROPIC_BASE_URL=\"https://ccr.duyet.net\"\n# Use either ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN (both work the same way)\nexport ANTHROPIC_API_KEY=\"your-openrouter-api-key\"\n# OR\nexport ANTHROPIC_AUTH_TOKEN=\"your-openrouter-api-key\"\n\n# Optional: Set default models\nexport ANTHROPIC_MODEL=\"moonshotai/kimi-k2:free\"\nexport ANTHROPIC_SMALL_FAST_MODEL=\"google/gemini-2.5-flash\"\n\n# Then simply run:\nclaude\n```\n\nThat's it! Claude Code will now use OpenRouter's models through the CCR proxy.\n\n## 📥 Installation\n\n### Manual Setup\n1. Add the environment variables to your shell profile:\n   ```bash\n   echo 'export ANTHROPIC_BASE_URL=\"https://ccr.duyet.net\"' \u003e\u003e ~/.bashrc\n   # Use either ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN (both work the same way)\n   echo 'export ANTHROPIC_API_KEY=\"your-openrouter-api-key\"' \u003e\u003e ~/.bashrc\n   # OR\n   echo 'export ANTHROPIC_AUTH_TOKEN=\"your-openrouter-api-key\"' \u003e\u003e ~/.bashrc\n   source ~/.bashrc\n   ```\n\n2. Start Claude Code:\n   ```bash\n   claude\n   ```\n\n## 🔧 Self-Hosting\n\nIf you want to deploy your own CCR instance:\n\n### Deploy to Cloudflare Workers\n\n```bash\n# Install Wrangler CLI\nnpm install -g wrangler\n\n# Clone and deploy\ngit clone https://github.com/duyet/ccr.git\ncd ccr\nwrangler deploy\n```\n\n### Configure Authentication\n\nSet your OpenRouter API key:\n\n```bash\nwrangler secret put OPENROUTER_API_KEY\n# Enter your OpenRouter API key when prompted\n```\n\n### Configure Environment Variables\n\nUpdate `wrangler.toml`:\n\n```toml\n[vars]\nOPENROUTER_BASE_URL = \"https://openrouter.ai/api/v1\"\n```\n\n#### How Model Selection Works\n\nCCR automatically handles model mapping:\n\n1. **OpenRouter Model IDs**: Models with `/` (like `moonshotai/kimi-k2:free`) are passed through directly\n2. **Claude Short Names**: `haiku`, `sonnet`, `opus` are mapped to their OpenRouter equivalents\n3. **Custom Models**: Any model name set via `ANTHROPIC_MODEL` environment variable is used as-is\n\nClaude Code users can override the default model using the `ANTHROPIC_MODEL` environment variable.\n\n## 🔒 Security \u0026 Privacy\n\n⚠️ **Important**: This is a proxy service. Your API key will be used to make requests to OpenRouter. Make sure to:\n- Use a secure connection\n- Keep your API key private\n- Only use trusted CCR instances\n\n## 🛠️ Local Development\n\nFor testing and development:\n\n```bash\n# Start local development server\nwrangler dev\n\n# Test locally with Claude Code\nexport ANTHROPIC_BASE_URL=\"http://localhost:8787\"\nexport ANTHROPIC_API_KEY=\"your-openrouter-api-key\"\nclaude\n```\n\n## 🚨 Troubleshooting\n\n### Common Issues\n\n**Authentication Error**\n```\nError: Invalid API key\n```\n- Ensure your OpenRouter API key is set: `wrangler secret put OPENROUTER_API_KEY`\n- Verify the key is valid at [OpenRouter](https://openrouter.ai)\n\n**Model Not Found**\n```\nError: Model not found\n```\n- Check supported models list above\n- Verify model is available on OpenRouter\n- Use full OpenRouter model ID if needed\n\n**Streaming Issues**\n```\nError: Connection timeout or malformed events\n```\n- Ensure your OpenRouter API key supports streaming\n- Check that the model you're using supports streaming responses\n\n**Worker Not Responding**\n- Check deployment status: `wrangler deployments list`\n- View logs: `wrangler tail`\n- Verify your worker domain is correct\n\n### Getting Help\n\n1. Check the [OpenRouter documentation](https://openrouter.ai/docs)\n2. View worker logs: `wrangler tail`\n3. Create an issue in this repository\n4. Visit your worker homepage for built-in documentation\n\n## ⚠️ Current Limitations\n\n- **Authentication**: Currently uses hardcoded token (will be fixed)\n- **Error Handling**: Basic error responses\n- **Rate Limiting**: Not implemented\n\n## 🔗 Links\n\n- [OpenRouter](https://openrouter.ai) - Get your API key\n- [Cloudflare Workers](https://workers.cloudflare.com) - Hosting platform\n- [Anthropic](https://anthropic.com) - Claude models\n- [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/) - Deployment tool\n\n## 📄 License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n---\n\n**Built entirely with [Claude Code](https://claude.ai/code)** - Showcasing AI-powered development workflow","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduyet%2Fccr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fduyet%2Fccr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduyet%2Fccr/lists"}