A comprehensive AI model proxy and discovery platform that provides unified access to multiple AI providers including OpenAI, Anthropic, Azure OpenAI, Cohere, and more.
- π Automatic Model Discovery: Real-time discovery and cataloging of AI models from all configured providers
- π High-Performance Proxy: Intelligent routing with circuit breakers, caching, and connection pooling
- π Comprehensive Monitoring: Prometheus metrics, health checks, and detailed analytics
- π§ͺ Chaos Engineering: Fault injection and resilience testing
- π° Cost Optimization: Context condensation and smart caching to reduce API costs
- π Enterprise Security: Rate limiting, authentication, and audit logging
# Clone the repository
git clone https://github.com/your-org/proxyapi.git
cd proxyapi
# Start with Docker Compose
docker-compose up -d
# Access the web interface
open http://localhost:8000# Install dependencies
pip install -r requirements.txt
# Set environment variables
export OPENAI_API_KEY="your-openai-key"
export API_KEY="your-proxy-key"
# Start the application
python main.pyThat's it! Your proxy API is now running at http://localhost:8000.
- Python 3.11+
- Docker & Docker Compose (recommended)
- 2GB RAM minimum, 4GB recommended
# Clone repository
git clone https://github.com/your-org/proxyapi.git
cd proxyapi
# Configure environment
cp .env.example .env
# Edit .env with your API keys
# Start services
docker-compose up -d# Install Python dependencies
pip install -r requirements.txt
# For enhanced performance (optional)
pip install httpx[http2] aiofiles watchdog psutil
# Configure providers
cp config.yaml.example config.yaml
# Edit config.yaml with your API keys
# Start application
python main_dynamic.pyCreate a config.yaml file with your provider configurations:
providers:
- name: "openai"
type: "openai"
api_key_env: "OPENAI_API_KEY"
models:
- "gpt-3.5-turbo"
- "gpt-4"
enabled: true
- name: "anthropic"
type: "anthropic"
api_key_env: "ANTHROPIC_API_KEY"
models:
- "claude-3-haiku"
- "claude-3-sonnet"
enabled: trueimport requests
# Make a chat completion request
response = requests.post(
"http://localhost:8000/v1/chat/completions",
headers={
"Content-Type": "application/json",
"X-API-Key": "your-proxy-key"
},
json={
"model": "gpt-4",
"messages": [
{"role": "user", "content": "Hello, how are you?"}
]
}
)
print(response.json())# Get all available models
response = requests.get("http://localhost:8000/v1/models")
models = response.json()
for model in models["data"]:
print(f"{model['id']}: {model['description']}")# Quick health check
curl http://localhost:8000/health
# Detailed system status
curl http://localhost:8000/v1/health- Getting Started Guide - Step-by-step tutorial for first-time users
- Quick Start Guide - Rapid setup and basic usage
- Installation Guide - Detailed installation instructions
- API Reference - Complete API documentation
- Integration Guide - Integration patterns and best practices
- Configuration Guide - Advanced configuration options
- Model Discovery Guide - Using the model discovery system
- Performance Guide - Optimization and performance tuning
- Monitoring Guide - Metrics, logging, and observability
- Security Guide - Security features and best practices
- Deployment Guide - Production deployment strategies
- Load Testing Guide - Performance testing and chaos engineering
- Troubleshooting Guide - Common issues and solutions
- Contributing Guide - How to contribute to the project
- Architecture Overview - System architecture and design
- Testing Guide - Testing strategies and practices
Automatically discovers and catalogs available AI models from all configured providers with real-time pricing and capabilities.
# Refresh model cache
curl -X POST http://localhost:8000/v1/models/refresh
# Search models by capabilities
curl "http://localhost:8000/v1/models/search?supports_vision=true&max_cost=0.01"Automatically summarizes long contexts to reduce API costs and improve performance.
# Long context is automatically handled
messages = [{"role": "user", "content": "Very long text..." * 1000}]
# API automatically condenses if needed
response = requests.post("http://localhost:8000/v1/chat/completions", json={
"model": "gpt-4",
"messages": messages
})Comprehensive monitoring with Prometheus metrics and health checks.
# Get metrics
curl http://localhost:8000/metrics
# Prometheus format
curl http://localhost:8000/metrics/prometheusWe welcome contributions! Please see our Contributing Guide for details.
# Clone repository
git clone https://github.com/your-org/proxyapi.git
cd proxyapi
# Install development dependencies
pip install -r requirements-dev.txt
# Run tests
pytest tests/
# Run linting
flake8 src/
black src/
mypy src/- π Documentation: Comprehensive docs in the
docs/directory - π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π§ Email: support@proxyapi.com
- Discord: Join our Discord
- Twitter: @ProxyAPI
- Blog: proxyapi.com/blog
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenAI for GPT models and API
- Anthropic for Claude models
- Microsoft for Azure OpenAI
- FastAPI for the excellent web framework
- All contributors who helped make this possible
β Star this repository if you find it useful!