One Protocol,
Every AI Provider.
AI-Lib is an open-source ecosystem that standardizes AI model interactions. One specification drives Rust and Python runtimes — supporting 30+ providers without a single line of hardcoded logic.
Three Projects, One Ecosystem
A specification layer defines the rules. Two runtime implementations bring them to life.
AI-Protocol
The provider-agnostic specification. YAML manifests define how to talk to every AI provider — no hardcoded logic, ever.
- 30+ provider manifests
- JSON Schema validated
- Streaming event normalization
- Error classification standard
- Hot-reloadable configuration
ai-lib-rust
High-performance Rust runtime. Operator-based streaming pipeline, compile-time safety, and sub-millisecond overhead.
- Operator-based pipeline
- Circuit breaker & rate limiter
- Embeddings & caching
- Plugin system
- Published on Crates.io
ai-lib-python
Developer-friendly Python runtime. Full async support, Pydantic v2 types, and production-grade telemetry.
- Async/await native
- Pydantic v2 type safety
- OpenTelemetry integration
- Model routing & load balancing
- Published on PyPI
Protocol-Driven Design
"All logic is operators, all configuration is protocol." Every provider behavior is declared in YAML — runtimes contain zero hardcoded provider logic.
Declarative Configuration
Provider endpoints, auth, parameter mappings, streaming decoders, and error handling — all declared in YAML manifests, validated by JSON Schema.
Operator-Based Pipeline
Streaming responses flow through composable operators: Decoder, Selector, Accumulator, FanOut, EventMapper. Each operator is protocol-driven.
Hot-Reload Ready
Update provider configurations without restarting. Protocol changes propagate automatically to runtimes. Add new providers through configuration, not code.
Ecosystem Architecture
Three layers working together — specification defines the rules, runtimes execute them, applications consume unified interfaces.
How It Works
From user request to unified streaming events — every step is protocol-driven.
Choose Your Runtime
Same protocol, different strengths. Pick the runtime that fits your stack.
| Capability | AI-Protocol | Rust SDK | Python SDK |
|---|---|---|---|
| Type System | JSON Schema | Compile-time (Rust) | Runtime (Pydantic v2) |
| Streaming | SSE/NDJSON spec | tokio async streams | async generators |
| Resilience | Retry policy spec | Circuit breaker, rate limiter, backpressure | ResilientExecutor with all patterns |
| Embeddings | — | Vector operations, similarity | Vector operations, similarity |
| Distribution | GitHub / npm | Crates.io | PyPI |
| Best For | Specification & standards | Systems, performance-critical | ML, data science, prototyping |
30+ AI Providers Supported
All driven by protocol configuration — zero hardcoded logic for any provider
Global Providers
China Region
Ready to get started?
Read the documentation, pick your runtime, and start building with 30+ AI providers today.