provider-architecture

Implement the LLMProvider trait to integrate 66+ LLM providers in Rust gateways.

104|19|Updated Jul 15, 2025
One-click install
npx skills add https://github.com/majiayu000/litellm-rs --skill provider-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: provider-architecture
Source: https://github.com/majiayu000/litellm-rs/tree/main/.claude/skills/provider-architecture
Command: npx skills add https://github.com/majiayu000/litellm-rs --skill provider-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses the challenge of integrating 66+ LLM providers behind a single, trait-object based LLMProvider interface, enabling scalable routing, consistent error handling, and maintainable architecture in Rust gateways.

Core Features & Use Cases

  • Unified provider abstraction for plug-and-play LLMs, including OpenAI-compatible APIs and alternative providers.
  • High-performance gateway routing with a single connection pool, deterministic request handling, and centralized cost/health management.
  • Use Case: Deploy a gateway that routes user requests to multiple providers (OpenAI, Azure, Google Vertex) based on model name, with fallbacks and cost-aware routing.

Quick Start

Start by implementing the LLMProvider trait for a provider, configure via environment variables, then initialize the provider and register it with the gateway router. Use a single GlobalPoolManager for HTTP calls and expose model information through the static registry. Run the gateway with the provider configuration loaded from env vars (e.g., OPENAI_API_KEY, AZURE_OPENAI_API_KEY, etc.).

Frequently Asked Questions about provider-architecture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I route requests to multiple LLM providers in a Rust gateway?

You can route requests to multiple LLM providers in a Rust gateway by implementing a single trait-object based LLMProvider interface. This approach enables deterministic provider patterns and centralized model discovery across diverse backends like OpenAI and Azure.

What is the best way to unify error handling across different LLM APIs in Rust?

The best way to unify error handling across LLM APIs in Rust is adopting a unified ProviderError type within a trait-object based architecture. This ensures consistent error management and maintainable routing across 66+ integrated providers.

How do I configure a Rust LLM gateway to manage HTTP connections for multiple providers?

To configure a Rust LLM gateway for multiple providers, wire a single GlobalPoolManager for HTTP calls and load provider credentials from environment variables. This setup enables high-performance routing with centralized health management.

Can I implement streaming and embeddings support in a unified LLM provider interface?

Yes, you can implement streaming and embeddings support in a unified LLM provider interface. The trait-object architecture provides optional streaming and embeddings capabilities alongside core request routing and static model registry exposure.

Does a trait-object based LLM gateway support cost-aware routing and fallbacks?

Yes, a trait-object based LLM gateway supports cost-aware routing and fallbacks. It enables scalable routing by matching requests to providers based on model name while maintaining centralized cost and health management.

When should I use a unified LLM gateway architecture instead of direct API integrations?

You should use a unified LLM gateway architecture instead of direct API integrations when you need to scale across multiple LLM providers. It provides plug-and-play provider abstraction, consistent error handling, and a single connection pool for high-performance routing.