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 that ships in this package.

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.

Re-run the proof against the corpus shipped in the wheel:

python -m llm_transform.corpus.runner

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

Metadata

Release files for llm-babel 0.3.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.3.0
File Size Uploaded Provenance Actions
llm_babel-0.3.0.tar.gz 495.5 kB Without provenance Details for llm_babel-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.2 MB

Release files / llm_babel-0.3.0.tar.gz

Download URL llm_babel-0.3.0.tar.gz
Size 495.5 kB
Tags Source
SHA-256 checksum
How to use checksums
50db6c12514f76be1ac46f0088aab67690dbb869a5e91c3b14fd61390aa49241
BLAKE2b-256 checksum
How to use checksums
0877bb8fefec561138bc3735398f2841fd774a5ddfd02e91e3d1a4fc8041653d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL llm_babel-0.3.0-py3-none-any.whl
Size 690.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e6bec577e49193bbfe347d7adac6d7c6f9270896b9605701eb030e6e24751d6
BLAKE2b-256 checksum
How to use checksums
670470c1233c1ee27e6c91a807b81cfcee49d37c0a2998cb5b47959f54b300d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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