Skip to content
Rosetta Stone

LLM-Rosetta

A unified message format conversion library for LLM provider APIs.

PyPI Release MIT arXiv

Just as the Rosetta Stone enabled translation between ancient scripts, LLM-Rosetta bridges the gap between incompatible LLM provider APIs — letting you speak any format and be understood by any provider.


The Problem

Different LLM providers use incompatible API formats. A request that works with OpenAI won't work with Anthropic or Google. Switching providers means rewriting integration code. Supporting multiple providers means maintaining N² converters.

LLM-Rosetta introduces a central Intermediate Representation (IR) as a hub. Each provider only needs one converter to/from the IR, reducing the total from N² to 2N.

Provider A ↔ IR ↔ Provider B — any format in, any format out.


Two Ways to Use

Convert between provider formats in your own code — no server needed:

from llm_rosetta import OpenAIChatConverter, AnthropicConverter

openai_conv = OpenAIChatConverter()
anthropic_conv = AnthropicConverter()

# OpenAI format → IR → Anthropic format
ir_request = openai_conv.request_from_provider(openai_request)
anthropic_request, warnings = anthropic_conv.request_to_provider(ir_request)
pip install llm-rosetta

Run a local HTTP proxy that translates between formats in real time:

Client (OpenAI format) ──→ Gateway ──→ Anthropic API
Client (Anthropic format) ──→ Gateway ──→ Google API
Client (Google format) ──→ Gateway ──→ Any provider
pip install "llm-rosetta[gateway]"
llm-rosetta-gateway

Drop-in backend for Claude Code, Gemini CLI, OpenAI Codex CLI, Kilo Code, and Ollama. See CLI Integrations.


Supported API Standards

Provider API Standard ProviderType
OpenAI Chat Completions openai_chat
OpenAI Responses openai_responses
Open Responses Vendor-neutral standard open_responses
Anthropic Messages anthropic
Google GenAI google

See API Standards for detailed format comparisons.


Key Features

Hub-and-Spoke Architecture Central IR eliminates N² conversion problem
Bidirectional Conversion Requests, responses, and messages in both directions
Streaming Support Convert streaming chunks with stateful context
Tool Calling Unified tool definition and call handling across providers
Auto Detection Detect provider format from request structure
Gateway + Admin Panel HTTP proxy with web UI for config, metrics, and logs
Type Safe Full TypedDict annotations for all types
Zero Overhead Pure dict transformations, no validation cost

Use Cases

Multi-provider applications — Build apps that switch between LLM providers without changing integration code. Use OpenAI in production and Claude for testing, or let users choose their provider.

AI coding tool proxy — Run a single gateway serving Claude Code, Gemini CLI, Codex CLI, and more, routing each to the right upstream.

Local model access — Point the gateway at Ollama or LM Studio to let cloud-SDK-based tools talk to local models with automatic format conversion.

API migration — Migrating providers? Convert existing request/response handling without rewriting business logic.


Documentation

  • Getting Started — Installation and first steps
  • Guide — Core concepts, converters, IR types, streaming
  • API Standards — Detailed comparison of supported formats
  • Gateway — HTTP proxy setup, configuration, CLI integrations
  • Examples — Cross-provider conversations, tool calling
  • API Reference — Complete API documentation
  • Changelog — Version history

Citation

If you use LLM-Rosetta in your research, please cite our paper:

@article{ding2026llm,
  title={LLM-Rosetta: A Hub-and-Spoke Intermediate Representation for Cross-Provider LLM API Translation},
  author={Ding, Peng},
  journal={arXiv preprint arXiv:2604.09360},
  year={2026}
}

License

MIT License