LLM Hub - Unified LLM Calling Library
A unified calling library supporting multiple LLM providers (International + Chinese AI), providing a consistent API interface.
📖 API Reference documentation can be found in the docs/ directory
✨ Features
- 🔌 Unified API - One interface for all LLM providers
- 🌍 Multi-Provider Support - OpenAI, DeepSeek, Kimi, Gemini, Claude, etc.
- 🇨🇳 Chinese AI Support - Qwen, GLM, ERNIE, MiniCPM
- 💻 Local Deployment - Ollama, llama.cpp
- 🤔 Reasoning Mode - Display thinking process (DeepSeek support)
- 📊 Accurate Token Counting - Official tokenizers for each provider
- 📡 Streaming Output - Real-time response generation
- 📁 File Upload - Support for PDF, Word, Excel, PPT, Image OCR, and more
- 💾 Configuration Management - JSON/YAML config, profiles, environment variables
- 🔌 Plugin System - Support for third-party Provider extensions
📋 Supported Providers
| Provider | Type | Token Counting | Reasoning Mode |
|---|---|---|---|
| OpenAI | Cloud | ✅ tiktoken | ❌ |
| DeepSeek | Cloud | ✅ deepseek-tokenizer | ✅ |
| Kimi | Cloud | ✅ API | ❌ |
| Google Gemini | Cloud | ⚠️ Estimation | ❌ |
| Anthropic Claude | Cloud | ⚠️ Estimation | ❌ |
| Qwen | Cloud | ✅ transformers | ❌ |
| GLM | Cloud | ✅ transformers | ❌ |
| ERNIE | Cloud | ✅ transformers | ❌ |
| MiniCPM | Cloud/Local | ✅ transformers | ❌ |
| Ollama | Local | ✅ API tokenize | ❌ |
| llama.cpp | Local | ✅ Subprocess | ❌ |
📁 Supported File Formats
| Category | Formats | Dependencies |
|---|---|---|
| Text | .txt, .md, .json, .csv | Built-in |
| Code | .py, .js, .java, .go, .cpp, etc. | Built-in |
| Documents | .pdf, .docx, .xlsx, .pptx | Optional |
| Images | .png, .jpg, .jpeg (OCR) | Optional |
| Web | .html, .xml | Optional |
| Config | .yaml, .toml, .ini | Optional |
| eBook | .epub | Optional |
🚀 Installation
# Basic installation
pip install gracefox-llm-hub
# Install environment sensing support (system resource monitoring)
pip install gracefox-llm-hub[env]
# Install accurate token counting
pip install gracefox-llm-hub[tokenizers]
# Install file upload support (all formats)
pip install gracefox-llm-hub[files-all]
# Install all features
pip install gracefox-llm-hub[all]
⚙️ Configuration
Supports JSON/YAML config files, environment variables, code parameters, and more.
{
"provider": "deepseek",
"model": "deepseek-chat",
"api_key": "your-api-key",
"temperature": 0.7,
"max_tokens": 2000,
"reasoning": true,
"stream": true
}
Configuration priority (low to high): Default → Environment variables → Profiles → Config files → JSON string → Code parameters
📦 Project Structure
llm-hub/
├── llm_hub/
│ ├── core/ # Core functionality (client, enums, exceptions)
│ ├── config/ # Configuration management (config, manager, security)
│ ├── models/ # Data models (message, conversation, response)
│ ├── providers/ # Provider implementations (base, factory, providers)
│ ├── environment/ # Environment sensing (optional, system monitoring)
│ └── utils/ # Utilities
│ ├── file_loader/ # File upload (multi-format support)
│ ├── stream_handler/ # Stream handling
│ ├── rate_limiter/ # Rate limiting
│ └── logger.py # Logging system
├── docs/ # API reference documentation
├── examples/ # Example code
└── pyproject.toml # Project configuration
🔧 Development
# Development installation
pip install -e .[dev,all]
# Code formatting
black llm_hub/
# Code linting
ruff check llm_hub/
# Type checking
mypy llm_hub/
🔌 Plugin System
LLM Hub supports third-party Provider extensions through the entry points mechanism.
# setup.py
setup(
entry_points={
"llm_hub.providers": [
"my_provider = my_package:MyProvider",
]
}
)
🤝 Contributing
Contributions are welcome! Please feel free to submit Pull Requests.
📄 License
GNU General Public License v3.0
📧 Contact
- Author: GraceFox
- Email: 948743980@qq.com
- Homepage: https://gitee.com/SteHub/llm-hub
Quick Reference
Installation Options
| Option | Description | Dependencies |
|---|---|---|
[env] |
Environment sensing | psutil |
[tokenizers] |
Accurate token counting | tiktoken, transformers |
[secure] |
Secure encryption | cryptography |
[yaml] |
YAML configuration | pyyaml |
[files-all] |
All file format support | pypdf, python-docx, openpyxl, etc. |
[all] |
All features | All of the above |
Supported Providers
| Provider | Config Value | Example Model |
|---|---|---|
| OpenAI | openai |
gpt-3.5-turbo |
| DeepSeek | deepseek |
deepseek-chat |
| Kimi | kimi |
moonshot-v1-8k |
| Qwen | qwen |
qwen-turbo |
| GLM | glm |
glm-4-flash |
| ERNIE | ernie |
ernie-3.5-8k |
| Ollama | ollama |
llama2 |
| llama.cpp | llama_cpp |
llama-2-7b |
API Key Acquisition
📖 Complete API reference documentation and usage examples can be found in the docs/ directory
⭐ If you find this useful, please give it a Star on Gitee!
Metadata
Release files for gracefox-llm-hub 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| gracefox_llm_hub-0.2.2.tar.gz | 96.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gracefox_llm_hub-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 201.5 kB
Release files / gracefox_llm_hub-0.2.2.tar.gz
| Download URL | gracefox_llm_hub-0.2.2.tar.gz |
|---|---|
| Size | 96.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
559d2c3c0fc13437638a18d1d941a86b447d92ac2ea63ef66f398c9b4e6fd1e3
|
|
BLAKE2b-256 checksum How to use checksums |
eb8b37957027fb5f8fd6b473a3cb8dbb65b4383ae62b9136ee46b1076eb16cb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|
Release files / gracefox_llm_hub-0.2.2-py3-none-any.whl
| Download URL | gracefox_llm_hub-0.2.2-py3-none-any.whl |
|---|---|
| Size | 104.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
22e7782740800c9274bd8ff39aae59f82e06dfb8925afeea871f161fdc2576f4
|
|
BLAKE2b-256 checksum How to use checksums |
a4fed9505406af1c75de9e81f0f5f0747ad8ae495e42ceafa94d19888ffe23ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|
Security for gracefox-llm-hub 0.2.2
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.