Install
API Keys
Set environment variables for the providers you’ll use:Your First Chat
The following shows simple agent usage using theAgent() constructor, which
takes a model string.
Agent.forProvider() constructor which takes a
provider directly:
Model Strings
The model string used byAgent can be specified in several ways:
- Just the
providerName, e.g.openai→ specifies whatever the default chat and embeddings models are for that provider providerName:chatModelName, e.g.google:gemini-2.0-flash→ specifies a provider and model, separated by a colonproviderName/chatModelName, e.g.google/gemini-2.0-flash→ specifies a provider and model, separated by a slashproviderName?chat=chatModelName&embeddings=embeddingsModelName→openai?chat=gpt-4&embeddings=text-embedding-ada-002→ uses query format
Providers
A provider is a Dart type likeGoogleProvider that knows how to expose model
objects. When you pass in a model string, you’re really looking up a provider
object and one or more types of model objects for the agent to do its work. All
the providers support a chat model (e.g. GoogleChatModel) and several of them
also support an embeddings model (e.g. GoogleEmbeddingsModel).
You can see the list of Supported Providers that Dartantic
exposes. And you can build your own Custom Providers if you
like.
Provider Aliases
Some providers support multiple provider prefixes. The alias can be used where the provider name is specified, e.g.gemini:gemini-2.0-flash →
google:gemini-2.0-flash. Here’s where you can see the list of aliases for each
of the Supported Providers.

