Skip to content

Model Providers

Elsai supports a wide range of LLM providers. The default is Amazon Bedrock, but you can switch with a single line.

Supported providers

To use model providers, make sure you install the standalone elsai-model package:

bash
pip install --extra-index-url https://core-packages.elsai.ai/root/elsai-model/ elsai-model
ProviderConnector ClassImport Path
Amazon BedrockBedrockConnectorelsai_model.bedrock
OpenAIOpenAIConnectorelsai_model.openai
Google GeminiGeminiServiceelsai_model.gemini
LiteLLMLiteLLMConnectorelsai_model.litellm
Azure OpenAIAzureOpenAIConnectorelsai_model.azure_openai
Anthropic (Bedrock)AnthropicBedrockConnectorelsai_model.anthropic_bedrock

Quick switch

When an elsai_model connector object is passed to the Agent's model parameter, the framework automatically detects and wraps it in an adapter:

python
from elsai import Agent
from elsai_model.openai import OpenAIConnector
from elsai_model.gemini import GeminiService
from elsai_model.bedrock import BedrockConnector
from elsai_model.litellm import LiteLLMConnector

# OpenAI
agent = Agent(model=OpenAIConnector(model_name="gpt-4o"))

# Gemini
agent = Agent(model=GeminiService(model="gemini-2.5-flash"))

# Amazon Bedrock
agent = Agent(model=BedrockConnector(model_id="anthropic.claude-3-5-sonnet-20241022-v2:0"))

# Ollama / Local (via LiteLLM Connector)
agent = Agent(model=LiteLLMConnector(model_id="ollama/llama3", api_base="http://localhost:11434"))

Common parameters

Most model classes accept these parameters:

ParameterDescription
model_idThe model identifier (required for most providers)
temperatureSampling temperature (0.0–1.0)
max_tokensMaximum tokens to generate
streamingEnable token streaming (default: True for most providers)

Custom model provider

Implement the Model protocol to use any LLM:

python
from elsai.models.model import Model
from collections.abc import AsyncIterator
from typing import Any

class MyCustomModel(Model):
    def converse(self, messages, system_prompt=None, tools=None, **kwargs) -> AsyncIterator[Any]:
        # Call your LLM here, yield events
        ...

agent = Agent(model=MyCustomModel())

Copyright © 2026 Elsai Foundry.