LLM Engine
Unified LLM API provider and engine library for Python.
Features
- Support for multiple LLM providers (OpenAI, DeepSeek, Ollama, Custom)
- Both synchronous and asynchronous API support
- Unified configuration via
providers.yml - Environment variable resolution
- Automatic retry logic
- Streaming support
- Token estimation and resource management
Installation
Install from PyPI:
pip install llm-engine
For local development:
cd llm-engine
pip install -e .
Or install with development dependencies:
pip install -e ".[dev]"
Configuration
Create a providers.yml file:
providers:
deepseek:
base_url: "https://api.deepseek.com/v1"
api_key: ${DEEPSEEK_API_KEY}
default_model: "deepseek-chat"
models:
- name: "deepseek-chat"
context_length: 128000
functions:
json_output: true
Usage
Async Usage
from llm_engine import LLMConfig, LLMProvider, LLMEngine
config = LLMConfig(
provider=LLMProvider.DEEPSEEK,
model_name="deepseek-chat",
api_key="your-api-key",
)
engine = LLMEngine(config)
response = await engine.generate("Hello, world!")
Sync Usage
from llm_engine import LLMConfig, LLMProvider
from llm_engine.providers.openai_compatible import OpenAICompatibleProvider
config = LLMConfig(
provider=LLMProvider.DEEPSEEK,
model_name="deepseek-chat",
api_key="your-api-key",
)
provider = OpenAICompatibleProvider(config)
response = provider.call("Hello, world!")
License
MIT
Metadata
Release files for llm-api-engine 0.1.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 | |
|---|---|---|---|
| llm_api_engine-0.1.2.tar.gz | 15.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llm_api_engine-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.4 kB
Release files / llm_api_engine-0.1.2.tar.gz
| Download URL | llm_api_engine-0.1.2.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8adc8b007cdefeb09bcbec23a2929b6100dfbfa5eb60ea73a174ec58782d56f
|
|
BLAKE2b-256 checksum How to use checksums |
8cced2dd259e791bf7b69c95c57c48bcd68f9402b254d31b46e77517d5ab44c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|
Release files / llm_api_engine-0.1.2-py3-none-any.whl
| Download URL | llm_api_engine-0.1.2-py3-none-any.whl |
|---|---|
| Size | 19.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40fad96e30e6e8dc2b57a13ca1df7826bd1f103c23ac632cb97205019d2009e4
|
|
BLAKE2b-256 checksum How to use checksums |
f30ee87da01f3a797f96dce6bec7afe34ec5cb30b15f3725b01b6d9b03dfea46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|