Supported Providers

Supported Providers

Dartantic currently supports the following AI model providers, but more are coming!

Drop me a line if you'd like to see a provider added or even better, if you'd like to contribute one!

Provider Capabilities

ProviderDefault ModelDefault Embedding ModelCapabilitiesNotes
OpenAIgpt-4otext-embedding-3-smallText Generation, Embeddings, Chat, File Uploads, ToolsFull feature support
OpenRoutergpt-4oN/AText Generation, Chat, File Uploads, ToolsNo embedding support
Google Geminigemini-2.0-flashtext-embedding-004Text Generation, Embeddings, Chat, File Uploads, ToolsUses native Gemini API
Gemini (OpenAI-compat)gemini-2.0-flashtext-embedding-004Text Generation, Embeddings, Chat, File Uploads, ToolsUses OpenAI-compatible Gemini endpoint

Provider Configuration

ProviderProvider PrefixAliasesAPI KeyProvider Type
OpenAIopenai-OPENAI_API_KEYOpenAiProvider
OpenRouteropenrouter-OPENROUTER_API_KEYOpenAiProvider
Google Geminigooglegemini, googleai, google-glaGEMINI_API_KEYGeminiProvider
Gemini (OpenAI-compatible)gemini-compat-GEMINI_API_KEYOpenAiProvider

API Key Environment Variables

If you don't provide an API key when creating an agent, dartantic_ai will look for API keys in the appropriate environment.

Example using Agent.environment

The Agent class provides an environment property that you can use to pass API keys along to the provider. This method is particularly suitable for setting API keys for multiple providers at once and for platforms that don't have their own environments, like Flutter Web.

void main() async {
  // Set API keys for both OpenAI and Gemini using environment variables
  Agent.environment.addAll({
    'OPENAI_API_KEY': 'your-openai-api-key-here',
    'GEMINI_API_KEY': 'your-gemini-api-key-here',
  });

  // Create and test OpenAI agent without explicitly passing an apiKey
  final openAiAgent = Agent('openai', systemPrompt: 'Be concise.');
  final openAiResult = await openAiAgent.run('Why is the sky blue?');
  print('# OpenAI Agent');
  print(openAiResult.output);

  // Create and test Gemini agent without explicitly passing an apiKey
  final geminiAgent = Agent('gemini', systemPrompt: 'Be concise.');
  final geminiResult = await geminiAgent.run('Why is the sea salty?');
  print('# Gemini Agent');
  print(geminiResult.output);
}

For a runnable example, take a look at agent_env.dart.