Skip to content
This repository was archived by the owner on Mar 14, 2026. It is now read-only.

feat: Add LiteLLM Proxy Integration for Multi-Provider LLM Support#34

Merged
takasaki404 merged 26 commits intomainfrom
wesley-working-branch
Sep 6, 2025
Merged

feat: Add LiteLLM Proxy Integration for Multi-Provider LLM Support#34
takasaki404 merged 26 commits intomainfrom
wesley-working-branch

Conversation

@Wes1eyyy
Copy link
Contributor

@Wes1eyyy Wes1eyyy commented Aug 21, 2025

Title: feat: Add LiteLLM Proxy Integration for Multi-Provider LLM Support

Description:

Summary

Adds LiteLLM Proxy integration to enable routing to multiple LLM providers through a unified API interface while maintaining full backward compatibility.

Changes

  • New LLM Client (app/clients/llm_client.py) - Async client for LiteLLM Proxy communication
  • New API Routes - /chat/completions_proxy, /chat/models, /chat/health endpoints
  • Configuration - Environment variables for LiteLLM settings in app/core/config.py
  • Infrastructure - Docker Compose setup for LiteLLM Proxy (infra/litellm/)
  • Generic Models - Provider-agnostic data models (app/models/llm.py)
  • Enhanced Error Handling - LLM-specific error codes (401, 429, 502, 504)

Key Features

  • 🔄 Multi-provider support (OpenAI, Anthropic, OpenRouter, Ollama)
  • 🛡️ Automatic fallback between providers
  • 💰 Cost optimization through smart routing
  • 🏠 Local model integration support
  • 📊 Built-in monitoring and analytics

Backward Compatibility

  • ✅ All existing routes unchanged
  • ✅ Original /chat/completions endpoint preserved
  • app/ai/aimo.py remains untouched
  • ✅ No breaking changes to existing functionality

Setup

# Start LiteLLM Proxy
cd infra/litellm
docker-compose -f docker-compose.litellm.yml up -d

# Verify integration
curl http://localhost:8000/api/v1.0.0/chat/health

- Added new endpoint `/completions_proxy` to handle chat completions via LiteLLM Proxy.
- Introduced LLMClient for unified access to multiple LLM providers.
- Implemented streaming and non-streaming responses for chat completions.
- Added endpoints for listing available models and health checks.
- Created standardized data models for LLM requests and responses.
- Updated configuration settings for LiteLLM Proxy.
- Added exception handling for OpenAI-specific errors.
- Implemented tests for the new chat proxy functionality and LLM client.
- Ensured backward compatibility with existing OpenAI models.
… to model configurations in litellm_config.yaml
@takasaki404 takasaki404 merged commit ca250f9 into main Sep 6, 2025
1 check failed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants