Skip to main content

Yet Another LLM Client

An opinionated python wrapper for LLM calls. Supports multiple LLM providers:

  • OpenAI
  • Anthropic
  • more to come...

Uses pydantic models to serialize LLM responses. Every response has to be serialized into a pydantic model.

Full async support.

Checking models

To verify which models in LLMModel are reachable with your current API keys:

cp .env.example .env  # fill in your API keys
uv run python scripts/check_models.py

Each model is called concurrently and results print as they complete.

Usage

Every call to the LLM returns some metadata. Metadata contains token usage, costs, model used and context messages. YALC supports 2 modes of operations for handling metadata.

Metadata return mode

Metadata is returned directly alongside the response as a tuple.

client = create_client(LLMModel.gpt_4o_mini)

result, metadata = await client.structured_response(
    JudgmentResult, messages
)

Advantages:

  • Simple, no setup required
  • Direct access to metadata at the call site

Disadvantages:

  • Must handle metadata manually on every call
  • Easy to forget or handle inconsistently across call sites

Strategy metadata mode

A metadata handler strategy is provided during client creation. The strategy is automatically invoked on every call when a context is passed. The provided context is used for any additional data that needs to be used when handling LLM call metadata.

# 1. Define your strategy
class LogStrategy(ClientMetadataStrategy[LLMLogContext]):
    def handle(self, call: ClientCall, context: LLMLogContext):
        print(f"Tokens: {call.input_tokens + call.output_tokens}")
        print(f"Cost: {call.input_tokens_cost + call.output_tokens_cost}")
        db.save(call.model_dump(), context.request_id)

# 2. Create client with the strategy
client = create_client(LLMModel.gpt_4o_mini, metadata_strategies=[LogStrategy()])

# 3. Pass context to trigger the strategy
result = await client.structured_response(
    JudgmentResult, messages, context=llm_log_context
)

Advantages:

  • Metadata handling is set up once and applied consistently
  • Call sites stay clean — no need to unpack or handle metadata each time

Disadvantages:

  • More initial setup
  • Metadata handling is implicit, which can be harder to trace

Metadata

Release files for yalc 0.3.2

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

Source distribution (sdist)

Source distribution for yalc 0.3.2
File Size Uploaded
yalc-0.3.2.tar.gz 110.6 kB Details

Built distribution (wheel)

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

Total release size: 119.6 kB

Release files / yalc-0.3.2.tar.gz

Download URL yalc-0.3.2.tar.gz
Size 110.6 kB
Tags Source
SHA-256 checksum
How to use checksums
71eb3f87e385dd15c589bffa366242dba7ffa357e2bff2c62d1b383e9710bc69
BLAKE2b-256 checksum
How to use checksums
63f3ba1a90f2f35243ca7d0f2b3bb78ddd087c18aabbe7842305098c6ee34a80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 26, 2026.

Transparency log

Release files / yalc-0.3.2-py3-none-any.whl

Download URL yalc-0.3.2-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07035b68f180e2f56d4ea249a6a4adbddd531bd7fecf708bfbf1e99ee88c48b1
BLAKE2b-256 checksum
How to use checksums
f4e679373059f254a6917c1dd7220e2a175f231dea17244cea94a29caed7eb8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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