# ClaudeCodeProxy
**Repository Path**: AIDotNet/ClaudeCodeProxy
## Basic Information
- **Project Name**: ClaudeCodeProxy
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2025-08-03
- **Last Updated**: 2025-08-06
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# ClaudeCodeProxy

**π Enterprise-Grade AI API Proxy Management Platform**
[](https://dotnet.microsoft.com/)
[](https://reactjs.org/)
[](https://www.typescriptlang.org/)
[](LICENSE)
[](https://makeapullrequest.com)
*A sophisticated, production-ready proxy management system for AI APIs with comprehensive monitoring, analytics, and multi-platform integration.*
[π **Getting Started**](#getting-started) β’ [π **Documentation**](#documentation) β’ [π **Features**](#features) β’ [π οΈ **API Reference**](#api-reference)
---
## π Table of Contents
- [β¨ Features](#-features)
- [ποΈ Architecture](#οΈ-architecture)
- [π Getting Started](#-getting-started)
- [π οΈ Installation](#οΈ-installation)
- [βοΈ Configuration](#οΈ-configuration)
- [π Dashboard](#-dashboard)
- [π§ API Reference](#-api-reference)
- [π Multi-Platform Support](#-multi-platform-support)
- [π Monitoring & Analytics](#-monitoring--analytics)
- [π Security](#-security)
- [π€ Contributing](#-contributing)
- [π License](#-license)
---
## β¨ Features
### π― **Core Capabilities**
|
**π API Key Management**
- Multi-platform API key lifecycle management
- Granular permissions & access controls
- Rate limiting & token quotas
- Automatic expiration handling
- Encryption at rest & in transit
**π’ Account Integration**
- OAuth flow management
- Multi-service authentication
- Intelligent load balancing
- Automatic failover & health checks
- Priority-based routing
|
**π Advanced Analytics**
- Real-time usage monitoring
- Cost tracking & attribution
- Performance metrics (RPM/TPM)
- Predictive capacity planning
- Custom reporting dashboards
**π‘οΈ Enterprise Security**
- JWT-based authentication
- IP restriction controls
- Comprehensive audit logging
- Role-based access control
- Secure credential storage
|
### π¨ **Management Interface**
- **Professional Dashboard** - Real-time metrics, system health, and KPI monitoring
- **Advanced Statistics** - Multi-dimensional analytics with interactive visualizations
- **Request Logging** - Comprehensive audit trails with filtering and search capabilities
- **Cost Analysis** - Financial tracking with detailed flow analysis and forecasting
- **User Management** - Secure authentication with role-based permissions
---
## ποΈ Architecture
```mermaid
graph TB
subgraph "Frontend (React 19)"
A[Admin Dashboard] --> B[API Key Manager]
A --> C[Analytics Dashboard]
A --> D[Account Manager]
A --> E[Request Logger]
end
subgraph "Backend (.NET 9 API)"
F[Authentication Service] --> G[Proxy Engine]
G --> H[Rate Limiter]
H --> I[Cost Calculator]
I --> J[Request Logger]
end
subgraph "AI Platforms"
K[Claude/Anthropic]
L[OpenAI]
M[Google Gemini]
end
subgraph "Data Layer"
N[SQLite Database]
O[Memory Cache]
end
A --> F
G --> K
G --> L
G --> M
J --> N
I --> O
```
### π οΈ **Tech Stack**
| Component | Technology | Version |
|-----------|------------|---------|
| **Backend** | .NET Core | 9.0 |
| **Frontend** | React + TypeScript | 19.x + 5.6 |
| **Database** | SQLite + EF Core | Latest |
| **UI Framework** | Tailwind CSS + Shadcn/ui | 3.x |
| **Build Tool** | Vite | 6.x |
| **Authentication** | JWT | - |
---
## π Getting Started
### π Prerequisites
- [.NET 9 SDK](https://dotnet.microsoft.com/download/dotnet/9.0)
- [Node.js 20+](https://nodejs.org/)
- [npm/yarn/pnpm](https://www.npmjs.com/)
### β‘ Quick Start
1. **Clone the repository**
```bash
git clone https://github.com/AIDotNet/ClaudeCodeProxy.git
cd ClaudeCodeProxy
```
2. **Start the backend**
```bash
cd src/ClaudeCodeProxy.Host
dotnet restore
dotnet run
```
3. **Start the frontend**
```bash
cd web
npm install
npm run dev
```
4. **Access the application**
- Frontend: http://localhost:5173
- Backend API: http://localhost:5000
- Swagger UI: http://localhost:5000/scalar/v1
---
## π οΈ Installation
### π³ Docker Deployment
```bash
# Build and run with Docker Compose
docker-compose up -d
```
### π₯οΈ Manual Deployment
1. **Backend Setup**
```bash
cd src/ClaudeCodeProxy.Host
dotnet publish -c Release -o ./publish
cd publish
dotnet ClaudeCodeProxy.Host.dll
```
2. **Frontend Build**
```bash
cd web
npm run build
# Serve the dist folder with your preferred web server
```
---
## βοΈ Configuration
### π§ Environment Variables
Create `appsettings.json` in the Host project:
```json
{
"ThorPlatformOptions": {
"DatabaseConnectionString": "Data Source=claudecodeproxy.db",
"JwtSettings": {
"SecretKey": "your-secret-key-here",
"Issuer": "ClaudeCodeProxy",
"Audience": "ClaudeCodeProxy-Users",
"ExpirationHours": 24
}
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
```
### ποΈ Frontend Configuration
Update `web/src/config/api.ts`:
```typescript
export const API_CONFIG = {
baseURL: process.env.VITE_API_URL || 'http://localhost:5000',
timeout: 30000,
retries: 3
};
```
---
## π Dashboard
### π― **Real-time Metrics**
**Key Features:**
- Live system performance indicators
- Cost tracking with trend analysis
- Token usage analytics (input/output/cache)
- API key status monitoring
- System uptime and health metrics
### π **Advanced Analytics**
- **Usage Heat Maps** - Visual representation of API usage patterns
- **Cost Flow Analysis** - Detailed financial attribution and forecasting
- **Performance Trends** - Historical data with predictive insights
- **User Profiling** - Behavioral analysis and usage optimization
---
## π§ API Reference
### π Authentication
All API endpoints require JWT authentication:
```bash
# Login to get JWT token
curl -X POST "http://localhost:5000/api/auth/login" \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"password"}'
# Use token in subsequent requests
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
"http://localhost:5000/api/apikeys"
```
### π Core Endpoints
| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | `/api/apikeys` | List all API keys |
| `POST` | `/api/apikeys` | Create new API key |
| `PUT` | `/api/apikeys/{id}` | Update API key |
| `DELETE` | `/api/apikeys/{id}` | Delete API key |
| `GET` | `/api/accounts` | List service accounts |
| `GET` | `/api/dashboard` | Dashboard statistics |
| `GET` | `/api/logs` | Request logs |
### π Proxy Endpoints
```bash
# Claude API Proxy
curl -X POST "http://localhost:5000/v1/messages" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"claude-3-sonnet","messages":[...]}'
# OpenAI API Proxy
curl -X POST "http://localhost:5000/v1/chat/completions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4","messages":[...]}'
```
---
## π Multi-Platform Support
### π€ **Supported AI Platforms**

Claude
OAuth Integration
|

OpenAI
Full API Support
|

Gemini
Project-based Auth
|
### β‘ **Platform Features**
- **Intelligent Routing** - Automatic platform selection based on request parameters
- **Model Mapping** - Cross-platform model compatibility management
- **Cost Calculation** - Platform-specific pricing models and usage tracking
- **Error Handling** - Platform-specific error codes and retry logic
---
## π Monitoring & Analytics
### π **Metrics Collection**
- **Request/Response Tracking** - Complete API transaction logging
- **Token Usage Monitoring** - Detailed input/output token calculation
- **Cost Attribution** - Real-time cost calculation and allocation
- **Performance Metrics** - Response time, throughput, and error rates
### π¨ **Alerting & Notifications**
- Real-time status updates and system health monitoring
- Usage threshold alerts with automatic notifications
- Error tracking with immediate notification of system issues
- Capacity planning with proactive scaling recommendations
---
## π Security
### π‘οΈ **Security Features**
- **π JWT Authentication** - Secure token-based authentication with configurable expiration
- **π Encrypted Storage** - API keys encrypted at rest and in transit
- **π¦ Rate Limiting** - Comprehensive throttling to prevent abuse
- **π IP Restrictions** - Client IP whitelisting for enhanced access control
- **π Audit Logging** - Complete audit trails for compliance and security monitoring
### π§ **Security Best Practices**
```json
{
"SecurityRecommendations": {
"JwtSecretKey": "Use a strong, randomly generated secret key (256+ bits)",
"DatabaseEncryption": "Enable SQLite encryption in production environments",
"TLS": "Always use HTTPS in production deployments",
"RateLimiting": "Configure appropriate rate limits based on your usage patterns",
"Monitoring": "Enable comprehensive logging and monitoring for security events"
}
}
```
---
## π€ Contributing
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
### π **Development Setup**
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
### π **Code Style**
- **Backend**: Follow [.NET coding conventions](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/inside-a-program/coding-conventions)
- **Frontend**: ESLint + Prettier configuration included
- **Commit Messages**: Use [Conventional Commits](https://www.conventionalcommits.org/)
---
## π License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
## π Acknowledgments
- [Anthropic](https://www.anthropic.com/) for Claude API
- [OpenAI](https://openai.com/) for GPT APIs
- [Google](https://ai.google.dev/) for Gemini API
- [Shadcn/ui](https://ui.shadcn.com/) for UI components
- [Tailwind CSS](https://tailwindcss.com/) for styling
---
**β Star this repo if you find it helpful!**
[π Report Bug](https://github.com/your-username/ClaudeCodeProxy/issues) β’ [β¨ Request Feature](https://github.com/your-username/ClaudeCodeProxy/issues) β’ [π¬ Discussions](https://github.com/your-username/ClaudeCodeProxy/discussions)
---
## π Documentation
**π [English](README.md) | [δΈζζζ‘£](README.zh-CN.md)**
**β Star this repo if you find it helpful!**
[π Report Bug](https://github.com/your-username/ClaudeCodeProxy/issues) β’ [β¨ Request Feature](https://github.com/your-username/ClaudeCodeProxy/issues) β’ [π¬ Discussions](https://github.com/your-username/ClaudeCodeProxy/discussions)
Made with β€οΈ by the ClaudeCodeProxy Team