A Cloudflare Worker that translates between Anthropic's Claude API and Google Gemini API, enabling Claude Code to use Gemini models as a drop-in replacement.
A Cloudflare Worker that acts as a translation layer between Anthropic's Claude API and Google's Gemini API. This enables you to use Claude Code with Google's Gemini models by proxying and transforming requests/responses between the two API formats.
This skill helps you work with the claude-gemini-router codebase, a Cloudflare Worker project that:
```bash
npm run dev
```
This starts a local Wrangler development server for testing the worker locally.
```bash
npm run deploy
```
Deploys the worker to your Cloudflare account.
When working with this codebase, understand these key modules:
1. Check if the feature exists in both Anthropic and Gemini APIs
2. Update type definitions in `src/types.ts` if needed
3. Add request transformation logic in `src/formatRequestGemini.ts`
4. Add response transformation logic in `src/formatResponseGemini.ts`
5. Handle streaming cases in `src/streamResponseGemini.ts` if applicable
6. Add unit tests to verify the transformation
7. Add integration tests to verify end-to-end behavior
1. Enable detailed logging in `src/logger.ts`
2. Use `npm run dev` to test locally with verbose output
3. Check the transformation logic in the format files
4. Compare actual API payloads against expected formats
5. Use integration tests to validate real API behavior
When modifying how requests or responses are translated:
1. Identify which direction needs changes (Anthropic→Gemini or Gemini→Anthropic)
2. Locate the relevant function in `formatRequestGemini.ts` or `formatResponseGemini.ts`
3. Update the transformation logic
4. Ensure streaming logic in `streamResponseGemini.ts` is consistent
5. Add/update tests to cover the changes
6. Test locally with `npm run dev` before deploying
After deploying, configure Claude Code to point to your worker URL instead of the Anthropic API endpoint. The worker will handle translation automatically, allowing you to use Gemini models through Claude Code's interface.
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/claude-gemini-api-router/raw