What LLM Providers Are Supported by deepwiki-rs? A Complete Guide

deepwiki-rs supports nine LLM providers: OpenAI, Anthropic, Google Gemini, Mistral, DeepSeek, Moonshot, OpenRouter, and Ollama for local models.

The deepwiki-rs Rust library provides a unified abstraction layer that allows developers to switch between different Large Language Model (LLM) backends without rewriting application logic. By implementing a consistent client interface across nine major providers, deepwiki-rs enables flexible AI integrations while maintaining type-safe Rust patterns.

Supported LLM Providers in deepwiki-rs

The library currently integrates with the following nine providers, each accessible through a unified configuration interface:

  • OpenAI – Standard OpenAI API including GPT-4, GPT-4o, and GPT-4o-mini models
  • Anthropic – Claude series models via the Anthropic Messages API
  • Gemini – Google Gemini models through the Google AI API
  • Mistral – Mistral AI platform models
  • DeepSeek – DeepSeek AI models
  • Moonshot – Moonshot AI platform
  • OpenRouter – OpenRouter gateway providing access to multiple underlying models
  • Ollama – Local self-hosted models running on Ollama servers

Each provider is defined as a variant in the LLMProvider enum located in src/config.rs, allowing compile-time safety when specifying backend targets.

Architecture: How Provider Abstraction Works

deepwiki-rs implements a two-layer abstraction strategy that separates configuration from runtime implementation.

Configuration Layer

The LLMProvider enum in src/config.rs (lines 11-27) defines the nine selectable backends that users configure via TOML files or programmatically:

// src/config.rs
pub enum LLMProvider {
    OpenAI,
    Anthropic,
    Gemini,
    Mistral,
    DeepSeek,
    Moonshot,
    OpenRouter,
    Ollama,
}

Runtime Layer

The ProviderClient enum in src/llm/client/providers.rs maps each configuration variant to a concrete rig client implementation. This enum implements the client trait methods that handle authentication, request formatting, and response parsing specific to each provider's API.

This architecture ensures that switching from OpenAI to Anthropic requires changing only the provider field in your configuration, while all agent creation and prompt execution code remains identical.

Configuring and Using LLM Providers

To instantiate a specific provider, configure the LLMConfig struct with your chosen LLMProvider variant and API credentials:

use deepwiki_rs::config::{LLMConfig, LLMProvider};
use deepwiki_rs::llm::client::ProviderClient;

// Configure for OpenAI (example)
let llm_cfg = LLMConfig {
    provider: LLMProvider::OpenAI,
    api_key: std::env::var("OPENAI_API_KEY")?,
    api_base_url: "https://api.openai.com/v1".into(),
    model_efficient: "gpt-4o-mini".into(),
    model_powerful: "gpt-4o".into(),
    max_tokens: 8192,
    temperature: Some(0.7),
    ..Default::default()
};

// Build the concrete client
let client = ProviderClient::new(&llm_cfg)?;

// Create an agent for a specific model tier
let agent = client.create_agent(
    "gpt-4o-mini",
    "You are a helpful documentation assistant.",
    &llm_cfg,
);

// Execute a prompt
let response = agent.prompt("Explain the architecture of deepwiki-rs.").await?;
println!("{}", response);

The ProviderClient::new() method inspects the provider field in your configuration and instantiates the appropriate underlying client for API communication.

Switching Between Providers

Changing LLM providers requires modifying only the provider variant and corresponding API credentials:

// Switch to Anthropic Claude
let llm_cfg = LLMConfig {
    provider: LLMProvider::Anthropic,
    api_key: std::env::var("ANTHROPIC_API_KEY")?,
    api_base_url: "https://api.anthropic.com/v1".into(),
    model_efficient: "claude-3-haiku-20240307".into(),
    model_powerful: "claude-3-opus-20240229".into(),
    ..Default::default()
};

// Or use local Ollama instance
let llm_cfg = LLMConfig {
    provider: LLMProvider::Ollama,
    api_key: "ollama".into(),  // Ollama typically doesn't require auth
    api_base_url: "http://localhost:11434".into(),
    model_efficient: "llama3.2".into(),
    model_powerful: "llama3.1:70b".into(),
    ..Default::default()
};

All agent creation and prompt execution code remains identical regardless of the selected provider, enabling seamless A/B testing or fallback strategies between different LLM services.

Summary

  • deepwiki-rs supports nine LLM providers: OpenAI, Anthropic, Gemini, Mistral, DeepSeek, Moonshot, OpenRouter, and Ollama.
  • Provider abstraction is implemented through the LLMProvider enum in src/config.rs and the ProviderClient enum in src/llm/client/providers.rs.
  • Configuration-driven switching allows changing providers by modifying only the provider field and API credentials, with all execution code remaining unchanged.
  • Local deployment support via Ollama enables self-hosted models alongside commercial API providers.

Frequently Asked Questions

How do I add a new LLM provider to deepwiki-rs?

To add a new provider, you must extend both the LLMProvider enum in src/config.rs and the ProviderClient enum in src/llm/client/providers.rs. You will also need to implement the client trait methods for the new provider's specific API authentication and request formatting. The modular architecture in the src/llm/client/ directory facilitates adding new backends without modifying existing provider implementations.

Does deepwiki-rs support local LLM models?

Yes, deepwiki-rs supports local models through the Ollama provider. Configure LLMProvider::Ollama with api_base_url pointing to your local Ollama server (typically http://localhost:11434). This allows you to run self-hosted models like Llama 3, Mistral, or other Ollama-compatible models without sending data to external APIs.

What is the difference between LLMProvider and ProviderClient?

LLMProvider is a configuration enum defined in src/config.rs that represents the user's selection of which LLM service to use. ProviderClient is a runtime enum defined in src/llm/client/providers.rs that contains the actual instantiated clients capable of making API calls. When you call ProviderClient::new(&llm_cfg), the function matches the LLMProvider variant from your configuration and returns the corresponding ProviderClient variant wrapped with the appropriate authentication and endpoint settings.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →