Skip to main content

A minimal, auditable Python library for calling multiple LLM providers. Lightweight LiteLLM alternative.

Project description

llm-adapters

A minimal, auditable Python library for calling multiple LLM providers. Built as a lightweight alternative to LiteLLM after the March 2026 PyPI supply chain attack.

Why?

  • Only 2 dependencies: httpx + pydantic — no official SDKs, no bloat
  • Each provider is a single file — fully readable and auditable
  • All deps pinned with hash verification in CI
  • < 2000 lines of code — anyone can review the entire codebase in minutes

Install

pip install llm-dial

Quick Start

from llm_adapters import LLMClient

client = LLMClient()

# Unified interface — auto-routes to the correct provider
response = await client.chat(
    model="openai/gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.content)

# Streaming
async for chunk in client.chat_stream(
    model="anthropic/claude-sonnet-4-20250514",
    messages=[{"role": "user", "content": "Tell me a story"}],
):
    print(chunk.content, end="")

Supported Providers

Provider Models Auth
OpenAI GPT-4o, GPT-4, o1, o3, etc. OPENAI_API_KEY
Anthropic Claude 4, Claude 3.5, etc. ANTHROPIC_API_KEY
DeepSeek deepseek-chat, deepseek-coder DEEPSEEK_API_KEY
Ollama Any local model (llama3, mistral, etc.) None (local)

Three Ways to Use

Your app
    │
    ├── As a library: from llm_adapters import LLMClient
    │
    ├── As a proxy: app → localhost:4000 → llm-adapters serve → LLM APIs
    │       (drop-in LiteLLM sidecar replacement, zero code changes)
    │
    └── As a gateway base: app → llm-gateway → llm-adapters → LLM APIs
            (add routing / auth / rate limiting / budget / observability)

Comparison with LiteLLM

LiteLLM llm-adapters
Dependencies 100+ transitive 2 (httpx + pydantic)
Install size ~50MB <1MB
Supply chain risk Compromised March 2026 Minimal attack surface
Supported models 100+ Core 4 providers (enough for most)
Code size Tens of thousands of lines <2000 lines
Auditability Complex One file per adapter

Security

This library was born from the LiteLLM supply chain incident. We take dependency security seriously:

  • Minimal dependency tree (2 direct deps)
  • All versions pinned with SHA-256 hashes in CI
  • Automated pip-audit on every PR
  • SBOM included in releases
  • Published via GitHub Actions OIDC (Trusted Publishers) — no PyPI tokens

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_dial-0.1.4.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_dial-0.1.4-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file llm_dial-0.1.4.tar.gz.

File metadata

  • Download URL: llm_dial-0.1.4.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llm_dial-0.1.4.tar.gz
Algorithm Hash digest
SHA256 585d968e9706f10eefc789220a0de07df2aa1e806f45e0efbab9af667e652f67
MD5 6c5a514a044075a18e725087dad47610
BLAKE2b-256 c53c326ce0440986d59901fd5e08ac9d2255dbdefbff7626558685348f5b07d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_dial-0.1.4.tar.gz:

Publisher: publish.yml on simonlemon333/llm-adapters

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_dial-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: llm_dial-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llm_dial-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fd7fb36169278850f4030e419af71a37078dfac88bfa6eda63d9346252708b72
MD5 ee2aaa56aba54a4d40a457d1b67e0ef9
BLAKE2b-256 a1e2c6b0438cd5a1f37fe53a92d3a1f095a3c9c732f42761caeedea2cb02b2de

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_dial-0.1.4-py3-none-any.whl:

Publisher: publish.yml on simonlemon333/llm-adapters

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page