Skip to main content

Installation

Add the following dependencies to your pubspec.yaml file:

Configuration

Get your API key from the Google AI Studio or your preferred LLM provider. Run your app with the API key:
In your Dart code, initialize the agent:
Then create your chat interface:
For a complete usage example, check out the gemini.dart sample.

Using Other LLM Providers

dartantic_ai supports multiple providers. Set the appropriate API key and configure the Agent:

Device Permissions

To enable your users to take advantage of features like voice input and media attachments, ensure that your app has the necessary permissions:

Network Access

On macOS, add the following to your *.entitlements files:
On Android, ensure your AndroidManifest.xml contains:

Clipboard Access

To enable copying and pasting images and other custom data to and from the Android clipboard, add the following content provider to your AndroidManifest.xml inside the <application> tag:
Be sure to replace <your-package-name> with your actual package name (e.g., com.example.myapp).

Other Permissions

Running Examples

Provide your API key via --dart-define:
See the example apps.