Skip to content

feat: implement web UI for configuration management and profile handling#32

Open
zimplexing wants to merge 6 commits intofuergaosi233:mainfrom
zimplexing:main
Open

feat: implement web UI for configuration management and profile handling#32
zimplexing wants to merge 6 commits intofuergaosi233:mainfrom
zimplexing:main

Conversation

@zimplexing
Copy link

No description provided.

aaaronmiller pushed a commit to aaaronmiller/claude-code-proxy that referenced this pull request Nov 19, 2025
…ion, passthrough mode, Docker improvements

This commit implements changes from PRs fuergaosi233#35, fuergaosi233#24, fuergaosi233#39, fuergaosi233#37, and fuergaosi233#32:

## PR fuergaosi233#35 + fuergaosi233#24: OpenAI Newer Models Support (o1, o3, o4, gpt-5)
- Add `is_newer_openai_model()` method to ModelManager to detect o1, o3, o4, gpt-5
- Add `is_o3_model()` method for specific o3 model detection
- Use `max_completion_tokens` instead of `max_tokens` for newer models
- Enforce `temperature=1` for newer OpenAI reasoning models
- Update test-connection endpoint to handle newer models correctly
- Fix compatibility with OpenAI's newer model API requirements

## PR fuergaosi233#39: Enhanced Conversion & Error Handling
- Add comprehensive input validation to request converter
- Validate Claude request structure before processing
- Add enhanced error handling in response converter
- Validate OpenAI response structure with detailed error messages
- Add prompt cache support for non-streaming responses
- Extract and include `cache_read_input_tokens` from prompt_tokens_details
- Improve error messages for debugging

## PR fuergaosi233#37: Multi-Tenant Passthrough Mode
- Add passthrough mode support for multi-tenant deployments
- Make OPENAI_API_KEY optional - enable passthrough mode when not set
- Add per-request API key support via `openai-api-key` header
- Update OpenAIClient to accept per-request API keys
- Add API key format validation (sk- prefix, minimum length)
- Update endpoints to extract and validate OpenAI API keys from headers
- Support both proxy mode (server key) and passthrough mode (user keys)
- Enable separate billing per tenant in passthrough mode

## PR fuergaosi233#32: Docker Improvements
- Add comprehensive .dockerignore file
- Exclude development files, tests, and sensitive data from Docker builds
- Reduce Docker image size by excluding unnecessary files
- Improve build performance with proper ignore patterns

## Additional Improvements
- Better error messages and logging throughout
- Enhanced API key validation
- Improved request/response handling

All changes maintain backward compatibility with existing deployments.
aaaronmiller pushed a commit to aaaronmiller/claude-code-proxy that referenced this pull request Nov 19, 2025
…33#32)

This commit fully implements the Web UI feature from PR fuergaosi233#32, providing a
comprehensive browser-based interface for managing the proxy.

## Features Implemented

### 1. Web-Based Configuration Editor
- Visual interface at http://localhost:8082/
- Edit all proxy settings through modern UI
- Real-time validation of configuration values
- Export configuration as .env file

### 2. Hot Reload (No Restart Required!)
- Apply configuration changes instantly
- Update API keys, models, settings on the fly
- Test different providers without downtime
- Debug configuration issues in real-time

### 3. Profile Management System
- Save multiple configuration sets
- Quick switch between profiles (dev, prod, test)
- Profile library with timestamps
- Import/export profiles as JSON
- Stored in configs/profiles/ directory

### 4. Model Browser (352+ Models)
- Search and filter 352+ OpenRouter models
- Filter by provider (OpenAI, Anthropic, Google, etc.)
- View context limits, pricing, capabilities
- Click to copy model IDs to clipboard

### 5. Real-Time Monitoring Dashboard
- Request statistics (count, tokens, cost, latency)
- Recent activity (last 10 requests with details)
- Live proxy status indicator
- Integration with usage_tracker when enabled

## Technical Implementation

### Frontend
- static/index.html - Main UI interface
- static/css/style.css - Modern dark theme styling
- static/js/app.js - JavaScript for interactivity
- Vanilla JS (no frameworks) for fast loading
- Responsive design for mobile/desktop

### Backend API
- src/api/web_ui.py - REST API endpoints
- GET/POST /api/config - Configuration management
- CRUD /api/profiles - Profile operations
- GET /api/models - Model listing
- GET /api/stats - Statistics and monitoring

### Integration
- Updated src/main.py - Added static file serving
- FastAPI StaticFiles mount at /static
- FileResponse for index.html at / and /config
- Integrated with existing config and usage_tracker

## API Endpoints

Configuration:
- GET /api/config - Get current configuration
- POST /api/config - Update config (hot reload)
- POST /api/config/reload - Reload from .env

Profiles:
- GET /api/profiles - List all profiles
- POST /api/profiles - Save profile
- GET /api/profiles/{name} - Load profile
- DELETE /api/profiles/{name} - Delete profile

Models & Stats:
- GET /api/models - List available models
- GET /api/stats - Get proxy statistics

## Files Added
- static/index.html (374 lines)
- static/css/style.css (425 lines)
- static/js/app.js (350 lines)
- static/README.md (documentation)
- src/api/web_ui.py (258 lines)
- configs/profiles/ (directory for storage)

## Files Modified
- src/main.py - Added web UI integration
- .env.example - Documented web UI feature

## Usage

1. Start proxy: python start_proxy.py
2. Open browser: http://localhost:8082/
3. Configure settings visually
4. Save as profile for reuse
5. Changes apply immediately (no restart!)

## Benefits

- ✅ No manual .env editing required
- ✅ Configuration changes without restart
- ✅ Visual model selection from 352+ models
- ✅ Profile switching for different environments
- ✅ Real-time monitoring and analytics
- ✅ Mobile-friendly responsive design
- ✅ Zero dependencies (vanilla JS)

This completes PR fuergaosi233#32 implementation with a full-featured web UI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant