Skip to main content

llm-babel

Translate an LLM request, response, error, or stream between provider wire formats, and get the exact same result whether it runs in Python, Rust, or TypeScript.

Every provider speaks a slightly different dialect on the wire. llm-babel routes everything through one neutral intermediate representation, so a format is one decoder plus one encoder rather than a converter per pair. The transforms are authored once as a small pure spec and compiled to plain Python, Rust, and TypeScript, proven byte-identical against a shared golden corpus every release has to pass in all three.

Formats: openai-chat, openai-responses, anthropic-messages, bedrock-converse, gemini, mistral, deepseek, cohere, plus the OpenAI-compatible providers (Groq, Cerebras, xAI, Z.AI, OpenRouter, HuggingFace) as routes over the openai-chat codec.

Install

pip install llm-babel                # the runtime: pure stdlib, no dependencies
pip install "llm-babel[validation]"  # adds Pydantic for the typed, validating IR surface

The import name is llm_transform.

Use

from llm_transform.registry import translate, decode, encode

translate("openai-chat", "anthropic-messages", openai_request)  # source wire -> target wire
decode("gemini", gemini_request)                                # any wire -> IR
encode("bedrock-converse", ir)                                  # IR -> any wire

Responses, errors, and streams have the same shape of API (translate_response, translate_error, fold_stream), and reconcile fits a request to a target's declared capabilities before encoding.

The same transforms are published for TypeScript as @pydantic/llm-babel on npm.

The golden corpus is not in this wheel, since it proves the transforms rather than running them. To re-run it yourself, take the sdist (pip download --no-binary :all: llm-babel) or the repository, where every backend runs it.

Metadata

Release files for llm-babel 0.4.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 llm-babel 0.4.0
File Size Uploaded Provenance Actions
llm_babel-0.4.0.tar.gz 790.5 kB Without provenance Details for llm_babel-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llm-babel 0.4.0
File Interpreter ABI Platform Actions
llm_babel-0.4.0-py3-none-any.whl Python 3 none any Details for llm_babel-0.4.0-py3-none-any.whl

Total release size: 1.1 MB

Release files / llm_babel-0.4.0.tar.gz

Download URL llm_babel-0.4.0.tar.gz
Size 790.5 kB
Tags Source
SHA-256 checksum
How to use checksums
56cd981e254c51d4f5732ca4d10a22135dd7020f53ccad9af3b9a8e0084a3b91
BLAKE2b-256 checksum
How to use checksums
e97b310abee8793a85644f729d5d16cf9c537fd57e841a7078193956e3eacb1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / llm_babel-0.4.0-py3-none-any.whl

Download URL llm_babel-0.4.0-py3-none-any.whl
Size 341.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36e769650b20070ec370a7074411321c5239bc9d18317404a69bb083c268d93c
BLAKE2b-256 checksum
How to use checksums
97fb57100a84ee1e47d7cefe84a04d33179998e21fb7392503be0ca13d8b611c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for llm-babel 0.4.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.

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