Skip to main content

Standard Interface for Large Language Models

Project description

no/llm

Standard Interface for Large Language Models
PyPI versions license

no/llm is a Python library that provides a unified interface for working with LLMs, with built-in support for model configuration, parameter validation, and provider management.

[!IMPORTANT] ⚠️ Early Stage Development
This project is in early stages and under active development. While we're working hard to maintain stability, APIs and features may change as we improve the library. We encourage you to try it out and provide feedback, but please be aware that production use should be carefully considered.

Quick Install

uv pip install "no_llm[pydantic-ai]"

Quick Example with Pydantic AI

[!TIP] Get a free API key from OpenRouter to test various models without individual provider accounts.

import os

from no_llm.integrations.pydantic_ai import NoLLMModel
from no_llm.registry import ModelRegistry
from no_llm.settings import ValidationMode, settings
from pydantic_ai import Agent
from pydantic_ai.settings import ModelSettings

settings.validation_mode = ValidationMode.ERROR
# or ValidationMode.WARN, ValidationMode.CLAMP

os.environ["OPENROUTER_API_KEY"] = "..."

# Get model from registry
registry = ModelRegistry()
openrouter_models = list(registry.list_models(provider="openrouter"))
print([m.identity.id for m in openrouter_models])
# > ['claude-3.5-haiku', 'claude-3.5-sonnet-v2', 'claude-3.7-sonnet', 'deepseek-chat', 'deepseek-r1-llama-70b-distilled', 'deepseek-reasoner', ...]
no_llm_model = NoLLMModel(*openrouter_models)

# Use with Pydantic AI
agent = Agent(no_llm_model, model_settings=ModelSettings(temperature=1.2))
result = agent.run_sync("What is the capital of France?")
print(result.data)
# > 2025-04-09 09:50:51.375 | WARNING  | no_llm.integrations.pydantic_ai:request:220 - Model deepseek-chat failed, trying next fallback. Error: Invalid value for parameter 'temperature'
# > Current value: 1.2
# > Valid range: (0.0, 1.0)
# > Error: Value 1.2 outside range [0.0, 1.0]
# > 2025-04-09 09:50:51.375 | WARNING  | no_llm.integrations.pydantic_ai:request:220 - Model deepseek-r1-llama-70b-distilled failed, trying next fallback. Error: Invalid value for parameter 'temperature'
# > Current value: 1.2
# > Valid range: (0.0, 1.0)
# > Error: Value 1.2 outside range [0.0, 1.0]
# ✅ gemini-2.0-flash
# > The capital of France is **Paris**.

Why no/llm?

  • Provider Agnostic: Support for OpenAI, Anthropic, Google, Mistral, Groq, and more through a single interface

  • Built-in Validation: Type-safe parameter validation and capability checking

  • Provider Fallbacks: Automatic fallback between providers and data centers

  • Configuration System: YAML-based model configurations with inheritance support

  • Model Registry: Central management of models with capability-based filtering

  • Integration Ready: Works with Pydantic AI, and more frameworks coming soon

Next Steps

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

no_llm-0.0.3.tar.gz (138.5 kB view details)

Uploaded Source

Built Distribution

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

no_llm-0.0.3-py3-none-any.whl (87.3 kB view details)

Uploaded Python 3

File details

Details for the file no_llm-0.0.3.tar.gz.

File metadata

  • Download URL: no_llm-0.0.3.tar.gz
  • Upload date:
  • Size: 138.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for no_llm-0.0.3.tar.gz
Algorithm Hash digest
SHA256 ff38bb2a79352489dca03d27dd8dab76c8756e3f2ef1e61f96bbb30ee7b8c308
MD5 767bf52b431fbf08a692f8d71443a584
BLAKE2b-256 100c9e565fd89468b6e0ccde50688d4e9ab0ed7f7d556a6b495e01f97761c5e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for no_llm-0.0.3.tar.gz:

Publisher: ci.yaml on Noxus-AI/no-llm

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

File details

Details for the file no_llm-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: no_llm-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 87.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for no_llm-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e75244d8ebc0bd63172dc4f75bf8e1494b520de66a1a9e35d911ac8af8277ff9
MD5 e6183884453225613090ffb9e850a4d8
BLAKE2b-256 b72a73562f77336c529b323d2cc74eea15c86d180a1a880e679c9cb7e24ac22d

See more details on using hashes here.

Provenance

The following attestation bundles were made for no_llm-0.0.3-py3-none-any.whl:

Publisher: ci.yaml on Noxus-AI/no-llm

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