Skip to content

About

FastAPI as a production service

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

LLM API Gateway

CI

A FastAPI service that gives client applications a common generation API across Gemini, OpenAI, and Anthropic, with authentication, rate limiting, retries, and delivery records.

Features

  • Client API keys stored as hashes.
  • Redis sliding-window rate limiting with configurable failure policy.
  • Provider adapters and normalized generation responses.
  • Bounded retries for transient upstream failures.
  • HMAC-signed webhook delivery and persisted delivery records.
  • Structured logging with correlation IDs.
  • SQLite development storage and PostgreSQL support.

Run locally

Requires Python 3.12 or newer. Redis is required for distributed rate limiting; a live provider key is required for generation.

git clone https://github.com/Jemade/API-WRAPPER.git
cd API-WRAPPER
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
alembic upgrade head
PYTHONPATH=. python scripts/create_api_key.py --name local-client
uvicorn app.main:app --reload --port 8080

Open http://localhost:8080/docs. Save the generated client key; only its hash is retained.

Defaults use SQLite. Configure provider keys, REDIS_URL, WEBHOOK_SECRET, and DATABASE_URL through environment variables or .env. The example file selects PostgreSQL, so adjust it to match your local database before loading it.

Containers and tests

docker compose up --build
pytest -q

Documentation

Current scope

This is a generation gateway, not a transparent implementation of every provider endpoint. Webhook records are persisted, but delivery runs in process rather than through a separate durable outbox worker. The Redis failure policy determines whether traffic is allowed or rejected during a Redis outage.

Contributing

See CONTRIBUTING.md for development checks, regression tests and review expectations. Use the issue templates for reproducible bugs or concrete feature proposals.

Engineering and contribution guide

Read the engineering notes for implementation boundaries and verification commands, the review checklist for evidence still required, and CONTRIBUTING.md to propose changes. Report vulnerabilities through SECURITY.md.

Repository hygiene

About

FastAPI as a production service

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages