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.

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
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.5.0.tar.gz (37.6 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.5.0-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for justllm-0.5.0.tar.gz
Algorithm Hash digest
SHA256 d5f36b58e01248a6416c20c44d29acf2d8664acf3b78f66003d5c34ed259d1f9
MD5 44053608fc3aa1f369ed2cd04be61b3a
BLAKE2b-256 2edc0441a0d94cfb7fa25e8d975e0ff949fff02df3193c12200336db6d6589fe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: justllm-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 19.7 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a6d234970e2233bd6012fc1f45f57ef5459db3dec576f08c5610237ef9295d60
MD5 c654fe27481e167236685a95ee72b534
BLAKE2b-256 bdb6ccadf032885ebd2d51fd0e8870257ccb51712aa81e008269f060722bd84d

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