How erlichliu/deepclaude works
Main Components
• API Gateway / Server: Represent the FastAPI app (app/main.py) that handles incoming HTTP requests on designated endpoints (including the configuration endpoints). This is the core entry point.
• Model and Client Layer: Organize the modules under the “app” directory into subcomponents:
• Clients: Under app/clients (base_client.py, claude_client.py, deepseek_client.py, openai_compatible_client.py) are the modules abstracting communications with external LLM services.
• Core Processing: The “deepclaude” module (app/deepclaude/deepclaude.py) that implements the main business logic and workflow for combining different model responses.
• Model Manager: The “app/manager” and “app/model_manager” (including model_configs.json) handle configurations and updates of model-related parameters and state.
• Composite Layer: The “openai_composite” module likely deals with aggregating or transforming responses to fit the OpenAI-compatible interface.
• Utilities: The “app/utils” directory provides common functionalities such as authentication and logging.
• Frontend Interface: Represent the static resources (HTML/CSS/JS under the frontend folder) that provide a graphical configuration interface for administrators/users to set API keys and manage model configurations.
• Deployment/Operations: Include Dockerfile, docker-compose.yml, and GitHub Actions files to indicate how the service is containerized, deployed, and automatically updated.
• Package Manager & Environment: Represent the usage of uv (uv lock, pyproject.toml) as a key dependency manager for running and managing the Python environment.
Relationships and Data Flow
• Logging and Authentication: Include extras showing supporting utilities that ensure secure communication and logging of operations.
Important Architectural Patterns
• Modularized Design: Emphasize the isolation of responsibilities with separate modules for client communications, business logic, and configuration management.
• API Gateway Pattern: The FastAPI server acts as a unified entry point that orchestrates request processing and response aggregation.
• Dependency Injection and Configurability: Illustrate how the model manager (and its configuration files such as model_configs.json) is used to dynamically adjust which models and API keys are active.
• Containerization and CI/CD: Include the Docker components and GitHub workflows, showing that build, deployment, and synchronization are automated.