Model Providers
Currently, the following providers are supported:
AnthropicOpenAIAzure OpenAI (docs.rs)Cohere (docs.rs)DeepSeek (docs.rs)EternalAI (source)Google Gemini (docs.rs)Galadriel (docs.rs)Groq (docs.rs)Hyperbolic (docs.rs)Mira (docs.rs)Moonshot (docs.rs)Ollama (docs.rs)OpenRouter (source)Perplexity (docs.rs)TogetherAI (docs.rs)xAI (docs.rs)
Each provider has its own module, which contains a Client
implementation that can
be used to initialize completion and embedding models and execute requests to those models.
The clients also contain methods to easily create higher level AI constructs such as agents and RAG systems, reducing the need for boilerplate.
Example
use rig::{providers::openai, agent::AgentBuilder};
// Initialize the OpenAI client
let openai = openai::Client::new("your-openai-api-key");
// Create a model and initialize an agent
let gpt_4o = openai.completion_model("gpt-4o");
let agent = AgentBuilder::new(gpt_4o)
.preamble("\
You are Gandalf the white and you will be conversing with other \
powerful beings to discuss the fate of Middle Earth.\
")
.build();
// Alternatively, you can initialize an agent directly
let agent = openai.agent("gpt-4o")
.preamble("\
You are Gandalf the white and you will be conversing with other \
powerful beings to discuss the fate of Middle Earth.\
")
.build();
Note: The example above uses the OpenAI provider client, but the same pattern can be used with the Cohere provider client.