Alchemy
A unified LLM API abstraction layer in Rust that supports 10+ providers through a consistent interface.
Warning: This project is in early development (v0.1.x). APIs may change without notice. Not recommended for production use yet.

Heavily inspired by and ported from: pi-mono/packages/ai
Supported Providers
- Anthropic (Claude)
- OpenAI (GPT-4, GPT-3.5)
- Google (Gemini)
- AWS Bedrock
- Mistral
- MiniMax (Global)
- MiniMax CN
- xAI (Grok)
- Groq
- Cerebras
- OpenRouter
Current first-class streaming implementations in Rust: OpenAI Completions and MiniMax Completions. Other provider APIs are being ported incrementally.
Features
- Streaming-first - All providers use async streams
- Type-safe - Leverages Rust's type system
- Provider-agnostic - Switch providers without code changes
- Tool calling - Function/tool support across providers
- Message transformation - Cross-provider message compatibility
Installation
Or add to your Cargo.toml:
[]
= "0.1"
Quick Start
use stream;
use ;
use StreamExt;
async
Latest Release
- Crate: alchemy-llm on crates.io
- Docs: docs.rs/alchemy-llm
- Current version:
0.1.5 - Release notes: CHANGELOG.md
- Highlights:
- Add first-class
ToolCallIdtype for unified tool-call identity - Add cross-provider tool-call smoke flow (OpenRouter, MiniMax, Chutes) with full typed response output
- Add first-class
Setup
-
Clone the repository
-
Configure API keys
# Edit .env and add your API keys -
Build the project
-
Run tests
-
Run the example
Examples
| Example | Description |
|---|---|
api_lifecycle |
Full API lifecycle demonstration |
simple_chat |
Basic chat with GPT-4o-mini |
tool_calling |
Tool/function calling with weather API |
minimax_live_reasoning_split |
Live MiniMax stream with reasoning_split enabled |
minimax_live_inline_think |
Live MiniMax stream exercising <think> fallback parsing |
minimax_live_usage_chunk |
Live MiniMax final message + usage summary |
Documentation
- docs/README.md - Documentation index
- docs/providers/minimax.md - MiniMax provider guide
- docs/api/lib.md - Public API surface
- docs/utils/transform.md - Message transformation guide
Development
See AGENTS.md for detailed development guidelines, architecture, and quality gates.
Quality Checks
Pre-commit hooks automatically run:
cargo fmt- Code formattingcargo clippy- Linting with complexity checkscargo check- Compilation
Run all quality checks:
Or run individually:
Tools used:
- Clippy - Cognitive complexity warnings (threshold: 20)
- polydup - Duplicate code detection (install:
cargo install polydup-cli)
License
MIT