Skip to main content

Centralized-LLM-Client

Unified Python client for interacting with multiple LLM providers (OpenAI, Gemini, OpenRouter) with automatic fallback, secure key management, file handling, and MongoDB logging.

Features

  • Automatic provider fallback (OpenAI, Gemini, OpenRouter)
  • Secure API key management (encrypted, MongoDB Atlas)
  • File handling: supports local, S3, and FastAPI UploadFile
  • Detailed logging of all LLM calls to MongoDB Atlas
  • S3 integration for file storage/retrieval

Installation

Python 3.9+ required.

pip install Centralized-LLM-Client
# Or, for local development:
pip install -r src/requirements.txt

Quickstart

from src.CentralizedClient import CentralizedLLMClient
client = CentralizedLLMClient(username="alice")
response = await client.completion("Summarize this document.")

Architecture

  • src/CentralizedClient/CentralizedLLMClient.py: Main orchestration, provider fallback logic
  • Providers: gemini_provider.py, openai_provider.py, openrouter_provider.py (wrap LLM APIs)
  • Key Management: key_manager.py (encrypted keys, user/system fallback)
  • File Handling: file_processor.py (temp files, S3/local/FastAPI)
  • Logging: llm_logger.py (MongoDB Atlas logging)
  • External Integrations: S3 (utils/s3_file_manager.py), MongoDB Atlas (utils/atlas_client.py)

Environment Setup

  • Set environment variables for S3, MongoDB Atlas, and LLM provider keys (see .env usage in utils)
  • Place key.bin (encryption key) in project root for key decryption

Testing

  • Add tests in tests/ and run with pytest:
     pytest tests/
    

Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

License

MIT License

Metadata

Release files for centralized-llm-client 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for centralized-llm-client 0.1.1
File Size Uploaded Provenance
centralized_llm_client-0.1.1.tar.gz 18.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for centralized-llm-client 0.1.1
File Interpreter ABI Platform
centralized_llm_client-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 40.6 kB

Release files / centralized_llm_client-0.1.1.tar.gz

Download URL centralized_llm_client-0.1.1.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fa5042abe0b35d6f26bba7a541ed9c4a1dd9a74a174df767fa29a43976d0d774
BLAKE2b-256 checksum
How to use checksums
0c95a7f7b28692087a8af9e871e5a6a51d752ea0ca6c123c56f6d318ac9d1cf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / centralized_llm_client-0.1.1-py3-none-any.whl

Download URL centralized_llm_client-0.1.1-py3-none-any.whl
Size 22.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4e5754d51345537c6130b28533ec14c4800d4b9b2c53dd5b6632695d09cc117
BLAKE2b-256 checksum
How to use checksums
91303f5b5e70335da160f49b7a656c652fb69759008d0af8264ddd07c6233606
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for centralized-llm-client 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page