Welcome to Dartantic!
The dartantic_ai package provides an agent framework designed to make building client and server-side apps in Dart with generative AI easier and more fun!
Key Features
- Agentic behavior with multi-step tool calling: Let your AI agents autonomously chain tool calls together to solve multi-step problems without human intervention.
- Multiple Providers Out of the Box - OpenAI, OpenAI Responses, Google,
Anthropic, Mistral, Cohere, Ollama, OpenRouter, xAI (Grok), xAI Responses, and
more; optional
dartantic_firebase_aifor Gemini via Firebase on Flutter - OpenAI-Compatibility - Access to literally thousands of providers via the OpenAI API that nearly every single modern LLM provider implements
- Streaming Output - Real-time response generation
- Typed Outputs and Tool Calling - Uses Dart types and JSON serialization
- Multimedia Input - Process text, images, and files
- Media Generation - Stream images, PDFs, and other artifacts from OpenAI Responses, xAI Responses (Grok Imagine), Google Gemini (Nano Banana), and Anthropic code execution. Supports image editing with native Imagen API for colorization, style transfer, and more
- Embeddings - Vector generation and semantic search
- Model Reasoning ("Thinking") - Extended reasoning support across OpenAI Responses, xAI Responses, Anthropic, and Google
- Provider-Hosted Server-Side Tools - Web search, file search, image generation, and code interpreter via OpenAI Responses, xAI Responses, Anthropic, and Google
- MCP Support - Model Context Protocol server integration
- Provider Switching - Switch between AI providers mid-conversation
- Production Ready: Built-in logging, error handling, and retry handling
- Extensible: Easy to add custom providers as well as tools of your own or from your favorite MCP servers
Quick Start
import 'package:dartantic_ai/dartantic_ai.dart';
void main() async {
// Create an agent with your preferred provider
final agent = Agent.forProvider(OpenAIProvider(apiKey: apiKey));
// Generate text
final result = await agent.send(
'Explain quantum computing in simple terms',
history: [ChatMessage.system('You are a helpful assistant.')],
);
print(result.output);
// Use typed outputs with json_schema_builder
final location = await agent.sendFor<TownAndCountry>(
'The windy city in the US',
outputSchema: S.object(
properties: {
'town': S.string(),
'country': S.string(),
},
required: ['town', 'country'],
),
outputFromJson: TownAndCountry.fromJson,
);
print('${location.output.town}, ${location.output.country}');
}
class TownAndCountry {
final String town;
final String country;
TownAndCountry({required this.town, required this.country});
factory TownAndCountry.fromJson(Map<String, Object?> json) => TownAndCountry(
town: json['town'] as String,
country: json['country'] as String,
);
}
Documentation
Read the full documentation at docs.dartantic.ai
Contributing & Community
Welcome contributions! Feature requests, bug reports and PRs are welcome on the dartantic_ai github site.
Want to chat about Dartantic? Drop by the Discussions forum.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ for the Dart & Flutter community
Libraries
- dartantic_ai
- Compatibility layer for language models, chat models, and embeddings.