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.
Release files for llm-babel 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llm_babel-0.2.2.tar.gz | 470.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llm_babel-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.1 MB
Release files / llm_babel-0.2.2.tar.gz
| Download URL | llm_babel-0.2.2.tar.gz |
|---|---|
| Size | 470.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bac370cf8de5fea90a56510fba021ad7f621d8cdefadd3c878bf8ddc902561bd
|
|
BLAKE2b-256 checksum How to use checksums |
4d9529c4e74882300f438dbbcfd878b273d81e9164101501bbd81ea3fb83b45e
|
| 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.2.2-py3-none-any.whl
| Download URL | llm_babel-0.2.2-py3-none-any.whl |
|---|---|
| Size | 674.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5434590fb6ff480969f479235490a33250d3464eae36e44bfb9540a8d55f568
|
|
BLAKE2b-256 checksum How to use checksums |
f04094fe833b09a32acc57239ec2dc046babae173860fdcf53fabb9610993cfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|