Skip to main content

Provider System

Egregore’s provider system offers a unified interface for interacting with 30+ AI providers including OpenAI, Anthropic, Google, Mistral, Cohere, and more. Write your code once, and it works seamlessly across all providers.

The Provider Problem

Different AI providers have different APIs, formats, and capabilities:
Egregore solves this with a single, unified interface.
Write code once using Egregore’s Agent API, and it works identically across all 30+ providers. Switch providers by changing a single string.

Using Providers

Provider String Format

Providers use the format provider:model:

Supported Providers

Egregore supports 30+ providers:

View All

Complete list of 30+ supported providers and models

API Key Configuration

Providers require API keys set via environment variables:
In Python:

Provider Interface

Unified Methods

All providers implement the same interface:
The same code works for ANY provider - just change the provider string:

Model Parameters

Configure model-specific parameters:
Parameters are provider-specific but many are common:
Egregore passes parameters directly to providers. Unsupported parameters are ignored gracefully.

Provider Features

Universal Token Counting

Egregore provides accurate token counting across all providers:
Works for all providers, even those without native token counting.

Streaming Support

All providers support streaming:

Tool/Function Calling

Providers with tool support work identically:

Multimodal Support

Providers supporting images, audio, or video use the same API:

Provider Switching

Runtime Provider Change

Switch providers without recreating the agent:

Fallback Providers

Implement provider fallback for reliability:

Model Comparison

Compare responses from multiple providers:

Provider Configuration

Parameter Merging

Egregore uses 3-tier parameter merging:
Example:

OAuth Interceptors

Premium models (GPT-5, Claude, etc.) use OAuth automatically:
OAuth is automatic for premium tier models. Egregore handles authentication flows transparently.

Provider Properties

Accessing Provider Info

Provider Capabilities

Check what a provider supports:

Best Practices

Write code that works across all providers:
Use environment variables for security:
Track usage to control costs:
Ensure your code works with multiple providers:
Choose models based on task requirements:

Common Patterns

Provider Selection by Task

A/B Testing Providers

Cost-Optimized Provider Selection

Multi-Provider Ensemble

Performance Considerations

Streaming for Long Responses

Use streaming for better perceived performance:

Provider Latency

Different providers have different latencies:

What’s Next?

Supported Providers

Complete list of 30+ providers and models

Provider API Reference

Detailed API documentation for providers

Token Counting

Universal token counting across providers

Adding Providers

Guide for contributing new provider integrations