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.3.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.3-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm_dial-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 4858d3bbb9371a075bd80d94e84b1ac2102ab5b1ed8933dbafe64c4239b0b680
MD5 6c7ca77d6b34d0ccd086d8571eb87663
BLAKE2b-256 36ade13ed62f7075ca33eb83760d25a67c935288a9b22caf94c86003d7e7e0c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_dial-0.1.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: llm_dial-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 18.1 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d8808d9a1c545c116b8c3a32ba5d3253aa6e7eb2e9910d9a8380512a314f853b
MD5 e819cf23bcbbfe667c2e1147acd934e1
BLAKE2b-256 474013f46e938a4576f250a9442bf6c4c7d68fabc36da8f6b66ee87f0dadf3e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_dial-0.1.3-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