Skip to main content
While you can configure providers with API keys manually, I wouldn’t recommend it. It’s much easier to just use the conventionally API key name and let your provider grab it from the environment.

Quick Start

You can just set up the API key values in your environment and let dartantic find them automatically:

Provider Variable Names

The optional Firebase AI add-on (dartantic_firebase_ai) does not use these environment variables; it relies on Firebase configuration, and the Google AI backend uses API keys configured in the Firebase project.

Agent Environment

The environment provided by your platform is a fall-back mechanism and it’s not always available, e.g. when you’re running dartantic in your Flutter web app. The first place that dartantic looks is the environment supplied by the Agent class itself:
The agent’s environment is the default place for providers to look for API keys and it’s available on all platforms. It’s useful for loading from .env files, your cloud vendor’s secrets database, Flutter’s compile-time constant mechanism or wherever fine API keys are grown. Only if the provider’s key isn’t found there will your platforms’s environment be checked (if your platform has an environment, that is).

Examples

Next Steps