llm-bridge-core-0.2.2 has been yanked.
llm-bridge-core
Protocol transform library for LLM API translation between Anthropic and OpenAI.
Overview
llm-bridge-core is a Rust library that translates request payloads, response payloads, and streaming SSE events between the Anthropic Messages API and OpenAI-compatible APIs (Chat Completions and Responses). It is a library-first, protocol-only component with no gateway concerns.
Features
- Anthropic → OpenAI: Convert Messages API requests to Chat Completions or Responses format
- OpenAI → Anthropic: Convert Chat Completions / Responses requests back to Messages API format
- Streaming: Cross-protocol SSE → SSE translation with cross-chunk state management
- Thinking: Anthropic thinking blocks ↔ OpenAI reasoning content translation
- Tool use: Cross-protocol tool call / tool result translation with semantic equivalence
- Streaming headers: Automatic
content-typedetection andx-no-response-completionhandling
Installation
[]
= "0.2"
Quick Start
use transform;
// Convert an Anthropic Messages API request to OpenAI Chat Completions format
let openai_body = anthropic_to_openai?;
// Convert an OpenAI response stream back to Anthropic format
let anthropic_body = openai_to_anthropic?;
Protocol Translation Matrix
| Anthropic Messages API | OpenAI Chat Completions | OpenAI Responses API |
|---|---|---|
messages (user/assistant) |
messages (role-based) |
input array |
system / system_prompt |
messages with system role |
instructions |
thinking blocks |
reasoning content |
reasoning content |
tool_use / tool_result |
tool_calls / tool messages |
tool_calls / tool messages |
SSE: message_start, content_block_delta, message_delta |
SSE: choices[0].delta |
SSE: response.output[*].content[*].delta |
Unsupported fields are logged before omission rather than silently dropped.
Crate Structure
crates/core/src/
├── lib.rs # Public API exports
├── config.rs # Runtime configuration
├── error.rs # Error types (thiserror-based)
├── types.rs # Shared type definitions
├── transform.rs # Protocol translation core
└── tests/
├── fixtures/ # Real API payload fixtures
└── e2e.rs # End-to-end streaming tests
Documentation
- API docs: docs.rs/llm-bridge-core
- Project docs: specs/index.md, docs/index.md
- Server: apps/server
License
MIT