Skip to main content

llmini

A minimal, ergonomic Python library for interacting with LLMs. Built on top of LiteLLM.

Features

  • Unified LLM access — works with Anthropic, OpenAI, and any LiteLLM-supported provider
  • Tool calling — define tools as Python functions, schemas are auto-generated from type hints and docstrings
  • Structured output — parse LLM responses into Pydantic models
  • Image support — send images in messages with automatic base64 encoding
  • Approval gating — mark tools as requiring approval before execution
  • Message serialization — export conversations as JSON or JSONL
  • Zero config — works out of the box with environment variables for API keys

Installation

uv add llmini

# or
pip install llmini

Quick Start

from llmini import ModelConfig, complete, system_message, user_message

reply = complete(
    model=ModelConfig(model="anthropic/claude-3-5-haiku-latest"),
    messages=[
        system_message("You are a helpful assistant."),
        user_message("What is the capital of France?"),
    ],
)

print(reply.content)  # "The capital of France is Paris."

With tools:

from llmini import ModelConfig, complete, system_message, user_message, make_tool

@make_tool()
def get_weather(location: str) -> str:
    """Get the current weather at a location."""
    return "Sunny, 22°C"

reply = complete(
    model=ModelConfig(model="anthropic/claude-3-5-haiku-latest"),
    messages=[
        system_message("You are a helpful assistant."),
        user_message("How's the weather in Paris?"),
    ],
    tools=[get_weather],
)

Building a tool-using agent loop: see examples/test_04_agent.py.

Documentation

  • USAGE.md — full API reference with all parameters, defaults, and detailed examples
  • examples/ — runnable example scripts

License

MIT

Metadata

Release files for llmini 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llmini 1.0.0
File Size Uploaded Provenance Actions
llmini-1.0.0.tar.gz 169.3 kB Without provenance Details for llmini-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llmini 1.0.0
File Interpreter ABI Platform Actions
llmini-1.0.0-py3-none-any.whl Python 3 none any Details for llmini-1.0.0-py3-none-any.whl

Total release size: 190.2 kB

Release files / llmini-1.0.0.tar.gz

Download URL llmini-1.0.0.tar.gz
Size 169.3 kB
Tags Source
SHA-256 checksum
How to use checksums
551ec2ff57211d82e31ef84643a8d3fcdaa6ec5f8464855524860b8932410938
BLAKE2b-256 checksum
How to use checksums
9536f2f525fc8ae7ae69885f4f93e5155325472a564641c04635f1110e621f75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release files / llmini-1.0.0-py3-none-any.whl

Download URL llmini-1.0.0-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3d818b736be1dd5c6c72a6f30733fa4c7f0c117c335594bf96a604180da5c2b8
BLAKE2b-256 checksum
How to use checksums
3651aaae3da79e2350dc7d28fe2677ca98821885e0dc93692f108a60685fa2c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Security for llmini 1.0.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page