Skip to main content

Production LLM calls. Just the three lines. Reliability, native caching, and reversible context compression on by default.

Project description

justllm

PyPI CI Python License: MIT

Production LLM calls. Just the three lines.

justllm demo

from justllm import LLM

llm = LLM("anthropic/claude-opus-4-8")
llm("Summarize this contract.")

That call already does the work you'd normally wire up yourself, on by default:

  • Context compression. Headroom shrinks tool output by 50–95% before it reaches the model.
  • Prompt-cache optimization. Cache breakpoints go where each provider wants them (Anthropic, OpenAI, Google).
  • Reliability. Calls retry with backoff, then fail over to the next provider.
pip install 'justllm[all]'

A little more

Same three lines. Each of these is one call or one kwarg:

llm.extract(Invoice, text)                    # structured output (validated Pydantic)
llm.stream("...")                             # token streaming
await llm.acall("...")                        # async
llm.map(prompts, concurrency=8)               # many prompts at once, in order
llm.embed(texts)                              # embeddings
chat = llm.chat(); chat.send("..."); chat.send("...")   # multi-turn, remembers history
llm.agent(system="...").run("...")            # tool-calling loop
LLM(router=Cascade(small=cheap, large=big))   # cheap first, escalate when needed

A few more things sit behind opt-in extras: OpenTelemetry traces that include the per-call dollar cost (most setups leave that out), Langfuse-backed prompts, semantic cascade escalation, and exact-match caching. The hard parts are already wired; you just call them.

Runnable recipes: cookbook

Why

The ecosystem splits two ways. You can have powerful but heavy (LiteLLM, LangChain), or simple but thin (aisuite, any-llm). justllm sits in the middle: every optimization is on, and the surface stays at three lines. Keeping it that small was most of the work.

justllm LiteLLM aisuite
three-line call yes yes yes
cross-provider fallback on by default config no
context compression on by default (Headroom) manual trim no
prompt-cache optimization on by default passthrough no
structured output yes (instructor) passthrough no
tool-calling agent yes (minimal) no no
surface area tiny large tiny

It runs on LiteLLM underneath, so think of it as the opinionated layer on top rather than a replacement.


Alpha. The wiring is tested on CI (Python 3.10–3.13) and the call paths are checked against live models.

Cookbook · Roadmap · Changelog · Contributing · 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

justllm-0.6.0.tar.gz (95.9 kB view details)

Uploaded Source

Built Distribution

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

justllm-0.6.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file justllm-0.6.0.tar.gz.

File metadata

  • Download URL: justllm-0.6.0.tar.gz
  • Upload date:
  • Size: 95.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for justllm-0.6.0.tar.gz
Algorithm Hash digest
SHA256 d8a4be96472b4e77e1995e87ffd48bba4e6c0310d938dd57a932424f1a02eb62
MD5 dee39c28c29a2c4d9dd93f05210b6c42
BLAKE2b-256 a6844f9935003cf22850bafb5537c4c0860599061f4012e24363385b97523d66

See more details on using hashes here.

File details

Details for the file justllm-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: justllm-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for justllm-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 759f6fe7b7f99edf983bb74f6c88e4969a469d05f19ec907ac71d06f72f4e714
MD5 c6f59697702b2c1fa8e4dbe1fa5a34b7
BLAKE2b-256 89cb7296ebd6d547e51d4968bd8357baf0d131b7691594bafcba362b779f70b2

See more details on using hashes here.

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