Skip to main content

Quick Start

Get started with development in minutes:
This project uses a local Tailwind CSS build system. CSS is pre-compiled and included in the repository, so you can run the project immediately after cloning.

Project Architecture

Request Flow

The proxy acts as a translator between:
  1. Anthropic Messages API format (input from Claude Code CLI)
  2. Google Generative AI format (Cloud Code API)
  3. Anthropic Messages API format (output back to CLI)

Directory Structure

Frontend Structure

Development Commands

Backend Development

Frontend Development

CSS Workflow:
  1. Edit public/css/src/input.css (Tailwind source with @apply directives)
  2. Run build command to compile
  3. Output: public/css/style.css (minified, committed to git)
When to rebuild CSS:
  • After modifying public/css/src/input.css
  • After pulling changes that updated CSS source
  • Automatically runs on npm install (via prepare hook)

Backend-Only Development

If you’re only working on backend code:
Pre-compiled CSS is committed to the repository, so you don’t need frontend build tools unless modifying styles.

Key Modules

Constants (src/constants.js)

All configuration values are centralized here:
  • API endpoints and headers
  • Model mappings and families
  • OAuth configuration
  • Rate limit thresholds
  • Fallback model mappings

Account Manager (src/account-manager/)

Manages multi-account pools with:
  • Three selection strategies: sticky, round-robin, hybrid
  • Rate limit tracking: Per-model rate limits with automatic cooldown
  • Quota awareness: Deprioritizes accounts below configurable thresholds
  • Health scoring: Tracks success/failure patterns for smart routing

Format Converters (src/format/)

Handles bidirectional conversion:
  • Request: Anthropic Messages API → Google Generative AI format
  • Response: Google responses → Anthropic streaming/non-streaming format
  • Thinking blocks: Validates and recovers thinking signatures across models
  • Cache control: Strips unsupported fields before sending to Cloud Code API

Logger (src/utils/logger.js)

Structured logging with colored output:

Contributing

We welcome contributions! Here’s how to get started:

1. Fork and Clone

2. Create a Branch

3. Make Changes

  • Follow existing code style and conventions
  • Add tests for new functionality
  • Update documentation (README.md, CLAUDE.md, docs) as needed
  • Ensure all tests pass: npm test

4. Test Your Changes

5. Submit a Pull Request

  • Write a clear description of your changes
  • Reference any related issues
  • Ensure CI checks pass

Code Style Guidelines

  • Use CommonJS (require/module.exports) for backend code
  • Use ES6+ features where appropriate (async/await, destructuring, etc.)
  • Follow existing patterns for consistency
  • Add JSDoc comments for public APIs
  • Use structured logging instead of console.log
  • Handle errors with custom error classes from src/errors.js

Frontend Development Patterns

Error Handling

Use ErrorHandler.withLoading() for async operations:

Service Layer

Use AccountActions for account operations:

Architecture Documentation

For detailed architecture information, see: When making significant changes, update both files to keep documentation in sync.

Getting Help

If you need help or have questions:
  • Open an issue on GitHub
  • Check existing issues for similar problems
  • Review the documentation and source code
We appreciate your contributions to making this project better!