sefia-litellm
A sefia LLMClient implementation that
connects to various LLM providers via
LiteLLM.
Install
pip install sefia-litellm
Or through the stack: pip install 'sefios[litellm]'.
Usage
import sefia_litellm
client = sefia_litellm.LiteLLMClient(model="gpt-4o")
Provider compatibility
Sefia connects to LiteLLM-supported LLM providers through the LiteLLM adapter. End-to-end operation has currently been verified with OpenAI, Anthropic, and Gemini only. Available features depend on the selected model and decision transport.
See the live-provider table and opt-in test command in the repository's
CONTRIBUTING.md.
Suppressing LiteLLM logging
LiteLLM logs through the standard-library LiteLLM logger — mostly INFO-level
messages that become visible whenever your application configures logging at
INFO/DEBUG — and, when a request raises, prints debug info including a
Provider List: ... banner. LiteLLMClient silences all of this by default.
Real failures still surface: LiteLLM raises exceptions on errors (which this
client maps to sefia exceptions), so silencing the logs never hides a failure.
There are two ways to control this:
-
Constructor argument
suppress_logs(takes precedence)# Suppress logs (default) client = sefia_litellm.LiteLLMClient(model="gpt-4o") client = sefia_litellm.LiteLLMClient(model="gpt-4o", suppress_logs=True) # Let LiteLLM log as usual client = sefia_litellm.LiteLLMClient(model="gpt-4o", suppress_logs=False)
-
Environment variable
SEFIA_LITELLM_SUPPRESS_LOGS(used as the default whensuppress_logsisNone)# Disable suppression (let logs through). 0/false/no/off disable it. export SEFIA_LITELLM_SUPPRESS_LOGS=false
An explicit
suppress_logsargument overrides the environment variable. When unset, suppression is on.
When suppression is on, the LiteLLM logger is fully silenced (its level is set
above CRITICAL) and litellm.suppress_debug_info is set to True. The logger
level is applied as soon as sefia_litellm is imported — before LiteLLM itself is
imported — so even LiteLLM's import-time warnings (e.g. optional-dependency
preload warnings) are suppressed.
On slow imports
Importing LiteLLM is heavy and can take around a second (see BerriAI/litellm#7605).
This package mitigates that as follows:
-
Lazy import — LiteLLM is imported only inside the methods that actually send a request. Importing
sefia_litellmalone costs nothing. After the first request the module is cached insys.modules, so subsequent imports are effectively free. This is the primary mitigation. -
Local model cost map —
LITELLM_LOCAL_MODEL_COST_MAP=Trueis set before LiteLLM is imported so that it uses its bundled cost map JSON instead of fetching it over the network. This speeds up the import and keeps it working offline.If you need up-to-date pricing for the newest models and the bundled map is stale, you can restore the original behavior:
export LITELLM_LOCAL_MODEL_COST_MAP=False
-
(Optional) Warm up at startup — if you also want to hide the first request's latency, import LiteLLM in the background during application startup. A daemon thread works regardless of whether an asyncio event loop is running yet:
import threading threading.Thread(target=__import__, args=("litellm",), daemon=True).start()
Status
Early development. APIs may change before v1.0.
License
MIT
Release files for sefia-litellm 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sefia_litellm-0.6.0.tar.gz | 32.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sefia_litellm-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 52.3 kB
Release files / sefia_litellm-0.6.0.tar.gz
| Download URL | sefia_litellm-0.6.0.tar.gz |
|---|---|
| Size | 32.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f38fdf0357337fe3eae48a87adfe2fff7004a2a7ae4badbc6ddd2d186669eb2
|
|
BLAKE2b-256 checksum How to use checksums |
d63e3e2af55323a46dcbecdcaa21c99a2b16bbe583b85995b2c1a55f7283c921
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / sefia_litellm-0.6.0-py3-none-any.whl
| Download URL | sefia_litellm-0.6.0-py3-none-any.whl |
|---|---|
| Size | 20.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cd1e4680c8b1c51ac11c65b79a622f2e60d8cdf4df8f9562e75ec13b45fda7b6
|
|
BLAKE2b-256 checksum How to use checksums |
4902dbf2b82e85836820e921f77cf7c8c1fcf9fa984b976291b5a710cc7360c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log