root 315326d0a2 feat(middleware): add auth, logging, and audit middleware
- Add authentication middleware with API key validation
- Add request logging middleware for observability
- Add audit logging middleware for admin operations
- Refactor API endpoints to use centralized auth middleware
- Add comprehensive unit tests for all middleware
- Add API documentation and deployment guide
- Update README with health endpoints and documentation links
- Fix test data isolation in router tests

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-03 03:23:37 +08:00
..

LLM Gateway

A unified LLM Gateway supporting multiple providers and API formats.

Features

  • Multi-format API: OpenAI Chat Completions, OpenAI Responses API, Anthropic Messages API
  • Multi-provider support: OpenAI, Anthropic, Azure OpenAI, Google Gemini, AWS Bedrock
  • Model aliasing and routing: Flexible model mapping with load balancing
  • Rate limiting: RPM/TPM limits at multiple levels
  • Budget control: Key and Project level spending limits
  • High availability: Fallback, retry, and circuit breaker
  • Observability: Request logging and usage statistics

Quick Start

# Install dependencies
pip install -r requirements.txt

# Run the server
uvicorn app.main:app --reload

API Endpoints

LLM APIs

  • POST /v1/chat/completions - OpenAI-compatible chat completions
  • POST /v1/responses - OpenAI Responses API
  • POST /v1/messages - Anthropic Messages API

Admin APIs

  • GET|POST|PUT|DELETE /admin/providers - Provider management
  • GET|POST|PUT|DELETE /admin/keys - API Key management
  • GET|POST|PUT|DELETE /admin/projects - Project management
  • GET|POST|PUT|DELETE /admin/models/aliases - Model alias management
  • GET /admin/usage/stats - Usage statistics

Health Endpoints

  • GET /health - Basic health check
  • GET /ready - Readiness check
  • GET /admin/providers/{id}/health - Provider health status

Documentation

Configuration

See .env.example for configuration options.

Docker

# Build and run
docker-compose up -d

# Check health
curl http://localhost:8000/health

License

MIT