Skip to main content
Your provider can expose a ChatModel, an EmbeddingsModel or both.

Dependencies

You do not need to depend on the dartantic_ai package to create a custom provider. The dartantic_interface package is all you need.

Creating a Custom Provider

Here’s a simple example of a custom provider that exposes a ChatModel:

Custom Model

Here’s a minimal chat model example:
With your custom provider, you can use it with an agent directly:

Dynamic Provider Registration

If you’d like to participate in the named lookup of providers, you can add your custom provider to the factory registry:
Note: The registry maps provider names to factory functions (Provider Function()), not instances. Each time a provider is requested, a fresh instance is created.

Examples

Next Steps