One Protocol,
Every AI Provider.
AI-Lib is an open-source ecosystem that standardizes AI model interactions. V2 protocol with MCP, Computer Use, and multimodal capabilities — 37 providers, three runtimes, zero hardcoded logic.
Six Projects, One Ecosystem
A specification layer defines the rules. Four runtime implementations (Rust, Python, TypeScript, Go) bring them to life.
AI-Protocol
The provider-agnostic specification. V2 three-ring manifests with MCP, Computer Use, and multimodal schemas — no hardcoded logic, ever.
- 37+ provider manifests (10 V2 + 27 V1)
- V2 three-layer pyramid architecture
- STT / TTS / Rerank in manifests (Jina, OpenAI, Cohere)
- MCP / Computer Use / Multimodal schemas
- ProviderContract + pricing schema
- CLI tool for validation & inspection
- JSON Schema validated
- Hot-reloadable configuration
ai-lib-rust
High-performance Rust runtime. E/P workspace (ai-lib-core + ai-lib-contact), manifest-driven Pipeline + AiClient, structured output, and feature-gated capability modules.
- AiClient + operator-based streaming pipeline
- ai-lib-core / ai-lib-contact workspace crates
- 13 V2 standard error codes
- Structured output & text-tool (TTC)
- Optional: embeddings, MCP bridge, computer_use (feature-gated)
- Opt-in resilience (ai_lib_rust::resilience)
- Published on Crates.io v1.0.1
ai-lib-python
Async Python runtime. E/P module separation, manifest-driven Pipeline + AiClient, Pydantic v2 types, and pip-extra capability modules.
- AiClient + operator-based streaming pipeline
- Fluent chat builder (.messages / .user / .stream)
- 13 V2 standard error codes
- Structured output & text-tool types
- Optional: embeddings, MCP bridge, computer_use (pip extras)
- Opt-in resilience (production_ready / resilience module)
- Published on PyPI v1.0.0
ai-lib-ts
TypeScript runtime for npm. HttpTransport + manifest parsers, /core and /contact entry points, opt-in policy layer.
- AiClient + manifest-driven HTTP chat
- /core (E) and /contact (P) entry points
- 13 V2 standard error codes
- StreamingEvent with event_type discriminator
- Optional: EmbeddingClient, McpToolBridge (format only)
- Default transport retry; CB/RL opt-in
- Published on npm v1.0.0
ai-lib-go
Go runtime (v1.0.0). pkg/ailib execution client + pkg/contact fallback policy; protocol-first HTTP with ExecutionMetadata.
- pkg/ailib Client + manifest HTTP chat
- pkg/contact FallbackClient (circuit breaker)
- 13 V2 standard error codes
- ChatStream SSE decoder (openai_sse default)
- Capability-gated endpoints (MCP/CU routes)
- Go 1.21+ context-aware API
Showcase Projects
Reference applications built on the AI-Lib ecosystem — see the protocol and runtimes in action.
AI Debate
Multi-model AI debate arena. Pro vs Con across four rounds, then a Judge delivers the verdict. Built on ai-lib-rust and ai-protocol.
- 4-round debate flow (Opening → Rebuttal → Defense → Closing → Judgement)
- Web search tool calling via Tavily (optional)
- Multi-provider: DeepSeek, Zhipu, Groq, Mistral, OpenAI, Anthropic
- Auto fallback, real-time SSE streaming
- Axum + SQLite, modern dark UI
ZeroSpider
Protocol-driven autonomous AI agent runtime, forked from ZeroClaw with ai-protocol integration, smart routing, and multi-model negotiation.
- Forked from ZeroClaw with ai-protocol ecosystem integration
- Smart routing: cost, speed, quality, reliability scoring
- Multi-model negotiation and parallel task execution
- Channels: Telegram, Discord, Matrix
- Remote deployment, hardware (GPIO, STM32)
SpiderSwitch
MCP server for dynamic AI model switching. Enables agents to discover, switch, and manage AI models across providers via standard MCP tools.
- MCP-compliant server over stdio transport
- switch_model / list_models / get_status / exit_switcher tools
- Protocol-driven: all configs from ai-protocol manifests
- Multi-provider: OpenAI, Anthropic, Google, DeepSeek, etc.
- Python + ai-lib-python SDK, auto protocol setup
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 | TypeScript SDK | Go SDK |
|---|---|---|---|---|---|
| Type System | JSON Schema | Compile-time (Rust) | Runtime (Pydantic v2) | Compile-time (TypeScript) | Compile-time (Go Structs) |
| Streaming | SSE/NDJSON spec | tokio async streams | async generators | AsyncIterator + fetch | Native stream iteration |
| Resilience | Retry policy spec | Circuit breaker, rate limiter, back-pressure | ResilientExecutor with all patterns | RetryPolicy, CircuitBreaker, RateLimiter | Context timeouts, auto-retry |
| V2 Driver | ProviderContract spec | Box<dyn ProviderDriver> | ProviderDriver ABC | ManifestV2 + HttpTransport | ProviderDriver interface |
| MCP | mcp.json schema | McpToolBridge | McpToolBridge | McpToolBridge | To be implemented |
| Computer Use | computer-use.json schema | ComputerAction + SafetyPolicy | ComputerAction + SafetyPolicy | — | — |
| Multimodal | multimodal.json schema | MultimodalCapabilities | MultimodalCapabilities | SttClient, TtsClient, RerankerClient | MultimodalCapabilities |
| Embeddings | — | Vector operations, similarity | Vector operations, similarity | EmbeddingClient | EmbeddingClient |
| Distribution | GitHub / npm | Crates.io | PyPI | npm | goproxy |
| Best For | Specification & standards | Systems, performance-critical | ML, data science, prototyping | Node.js, npm ecosystem, full-stack | High-concurrency servers, microservices |
37 AI Providers Supported
All driven by protocol configuration — zero hardcoded logic for any provider. 6 V2 manifests with MCP/CU/Multimodal declarations.
Global Providers
China Region
Ready to get started?
Read the documentation, pick your runtime (Rust, Python, TypeScript, or Go), and start building with 37+ AI providers today.