### Install Dependencies and Run Examples Source: https://github.com/latias94/llm_dart/blob/main/example/06_mcp_integration/README.md Commands to navigate to the example directory, install dependencies, and run various MCP concept and client demos. ```bash # Enter the standalone example package cd example/06_mcp_integration # Install dependencies dart pub get # Start with the concept walkthrough dart run mcp_concept_demo.dart # stdio MCP. The client examples spawn the stdio server process. dart run stdio_examples/client.dart dart run stdio_examples/llm_client.dart # HTTP MCP. Start the server in one terminal, then run clients separately. dart run http_examples/server.dart dart run http_examples/client.dart dart run http_examples/llm_client.dart dart run http_examples/simple_stream_client.dart ``` -------------------------------- ### Setup Google API Key and Run Examples Source: https://github.com/latias94/llm_dart/blob/main/example/04_providers/google/README.md Environment variable setup for Google API key and commands to run example scripts. ```bash export GOOGLE_API_KEY="your-google-api-key" dart run embeddings.dart dart run image_generation.dart ``` ```bash dart run google_tts_example.dart ``` -------------------------------- ### Setup API Keys and Run Examples Source: https://github.com/latias94/llm_dart/blob/main/example/04_providers/README.md Set environment variables for API keys and run specific provider examples. Ensure you replace placeholder keys with your actual API keys. ```bash export OPENAI_API_KEY="your-openai-key" export ANTHROPIC_API_KEY="your-anthropic-key" export DEEPSEEK_API_KEY="your-deepseek-key" export GROQ_API_KEY="your-groq-key" export GOOGLE_API_KEY="your-google-key" export ELEVENLABS_API_KEY="your-elevenlabs-key" export XAI_API_KEY="your-xai-key" export OPENROUTER_API_KEY="your-openrouter-key" dart run groq/fast_inference.dart dart run anthropic/extended_thinking.dart dart run google/image_generation.dart dart run xai/live_search.dart ``` -------------------------------- ### Ollama Setup and Execution Source: https://github.com/latias94/llm_dart/blob/main/example/04_providers/ollama/README.md Instructions for setting up Ollama, pulling a model, starting the server, and running Dart examples. Ensure Ollama is installed and running before executing the Dart scripts. ```bash curl -fsSL https://ollama.ai/install.sh | sh ollama pull llama3.2 ollama serve dart run advanced_features.dart dart run thinking_example.dart ``` -------------------------------- ### Setup Groq API Key and Run Example Source: https://github.com/latias94/llm_dart/blob/main/example/04_providers/groq/README.md Set the GROQ_API_KEY environment variable and execute the inference script. ```bash export GROQ_API_KEY="your-groq-api-key" dart run fast_inference.dart ``` -------------------------------- ### Analyze Example Code for Getting Started Source: https://github.com/latias94/llm_dart/blob/main/docs/workstreams/2026-05-root-legacy-prompt-options-breaking-line/TODO.md Runs Dart analysis on example code for getting started, including quick start, basic configuration, and provider comparison. This ensures the initial examples are free of analysis errors. ```dart dart analyze example/01_getting_started/quick_start.dart example/01_getting_started/basic_configuration.dart example/01_getting_started/provider_comparison.dart ``` -------------------------------- ### Setup OpenAI API Key and Run Examples Source: https://github.com/latias94/llm_dart/blob/main/example/04_providers/openai/README.md Set the OPENAI_API_KEY environment variable and run specific Dart example files. ```bash export OPENAI_API_KEY="your-openai-api-key" dart run image_generation.dart dart run image_and_file_messages.dart dart run audio_capabilities.dart dart run gpt5_features.dart dart run advanced_features.dart ``` ```bash dart run responses_api.dart dart run build_openai_responses_demo.dart ``` -------------------------------- ### Start the HTTP MCP server Source: https://github.com/latias94/llm_dart/blob/main/example/06_mcp_integration/http_examples/README.md Navigate to the example directory and run the server script. The server will listen on http://localhost:3000/mcp. ```bash cd example/06_mcp_integration dart run http_examples/server.dart ``` -------------------------------- ### Setup Anthropic API Key and Run Examples Source: https://github.com/latias94/llm_dart/blob/main/example/04_providers/anthropic/README.md Set the ANTHROPIC_API_KEY environment variable and run the provided Dart examples for Anthropic provider features. ```bash export ANTHROPIC_API_KEY="your-anthropic-api-key" dart run extended_thinking.dart dart run streaming_tool_calling.dart dart run mcp_connector.dart ``` ```bash dart run file_handling.dart ``` -------------------------------- ### Run Runnable Examples Source: https://github.com/latias94/llm_dart/blob/main/packages/llm_dart_elevenlabs/README.md Execute the provided example scripts from the package directory to test different functionalities. ```bash dart run example/elevenlabs_speech.dart ``` ```bash dart run example/elevenlabs_transcription.dart ``` ```bash dart run example/elevenlabs_voice_catalog.dart ``` -------------------------------- ### Run Example Scripts Source: https://github.com/latias94/llm_dart/blob/main/packages/llm_dart_ollama/README.md Execute example scripts directly from the package directory to test different functionalities like chat, embeddings, and model catalog. ```bash dart run example/ollama_chat.dart dart run example/ollama_embeddings.dart dart run example/ollama_model_catalog.dart ``` -------------------------------- ### Run Dart Examples Source: https://github.com/latias94/llm_dart/blob/main/example/README.md Execute various Dart examples from the project to explore different features and use cases. Some examples accept command-line arguments. ```bash dart run 01_getting_started/quick_start.dart dart run 02_core_features/chat_basics.dart dart run 02_core_features/capability_profile_ui_gating.dart dart run 05_use_cases/chatbot.dart dart run ../packages/llm_dart_chat/example/chat_runtime.dart dart run ../packages/llm_dart_chat/example/http_backend_hint_mapping.dart dart run 05_use_cases/batch_processor.dart --help dart run 05_use_cases/multimodal_app.dart --demo ``` -------------------------------- ### Run Flutter Package Examples Source: https://github.com/latias94/llm_dart/blob/main/example/README.md Navigate to the Flutter package directory and run Flutter examples using 'flutter run'. Specific entry points are provided for different demos. ```bash cd ../packages/llm_dart_flutter flutter run -t example/flutter_material_chat_demo.dart flutter run -t example/flutter_capability_gated_controls.dart ``` -------------------------------- ### Run Example API Guards Check Source: https://github.com/latias94/llm_dart/blob/main/docs/workstreams/2026-05-core-seam-fearless-refactor/EVIDENCE_AND_GATES.md Executes the tool to check example API guards. ```powershell dart run tool\check_example_api_guards.dart ``` -------------------------------- ### Run LLM Dart Examples Source: https://github.com/latias94/llm_dart/blob/main/example/01_getting_started/README.md Execute the provided LLM Dart example scripts using the Dart runtime. Ensure API keys are set before running. ```bash dart run quick_start.dart dart run provider_comparison.dart dart run basic_configuration.dart ``` -------------------------------- ### Flutter Chat Controller Setup Source: https://github.com/latias94/llm_dart/blob/main/docs/workstreams/2026-03-architecture-refactor/38-migration-guide.md Demonstrates setting up a ChatController for Flutter UI integration with llm_dart. This example uses DirectChatTransport and a specific OpenAI model. ```dart import 'package:llm_dart/llm_dart.dart' as llm; import 'package:llm_dart_flutter/llm_dart_flutter.dart'; final controller = ChatController( session: DefaultChatSession( transport: DirectChatTransport( model: llm.openai( apiKey: 'your-openai-key', ).chatModel('gpt-4.1-mini'), ), ), ); await controller.sendMessage( ChatInput.text('Write a short haiku about Flutter widgets.'), ); ``` -------------------------------- ### Run LLM Integration Example Source: https://github.com/latias94/llm_dart/blob/main/example/06_mcp_integration/stdio_examples/README.md Execute the primary LLM integration example which uses `generateText(...)` with automatic MCP tool continuation. Ensure your OpenAI API key is set. ```bash export OPENAI_API_KEY="your-key-here" dart run stdio_examples/llm_client.dart ``` -------------------------------- ### Run Example API Guards Source: https://github.com/latias94/llm_dart/blob/main/docs/workstreams/2026-05-alpha-release-hardening/01-release-readiness-command.md Execute checks for API guards within examples. This ensures that example code adheres to API best practices. ```bash dart run tool/check_example_api_guards.dart ``` -------------------------------- ### Test Example API Guards Source: https://github.com/latias94/llm_dart/blob/main/docs/workstreams/2026-05-core-seam-fearless-refactor/EVIDENCE_AND_GATES.md Runs tests for the example API guards. ```powershell dart test test\tool\check_example_api_guards_test.dart ``` -------------------------------- ### Quick Start: Generate Text with OpenAI Source: https://github.com/latias94/llm_dart/blob/main/README.md Demonstrates how to use the default root entrypoint to generate text with an OpenAI model. Ensure you have the 'llm_dart_openai' package and replace 'your-openai-key' with your actual API key. ```dart import 'package:llm_dart/core.dart' as core; import 'package:llm_dart_openai/llm_dart_openai.dart' as openai; Future main() async { final model = openai.openai( apiKey: 'your-openai-key', ).chatModel('gpt-4.1-mini'); final result = await core.generateTextCall( model: model, messages: [ core.SystemModelMessage.text('You are concise.'), core.UserModelMessage.text('Explain Dart in one sentence.'), ], ); print(result.text); } ``` -------------------------------- ### Analyze Example Code for Core Features Source: https://github.com/latias94/llm_dart/blob/main/docs/workstreams/2026-05-root-legacy-prompt-options-breaking-line/TODO.md Runs Dart analysis on example code for core features like streaming chat, structured output, and tool calling. This helps identify potential issues in example implementations. ```dart dart analyze example/02_core_features/streaming_chat.dart example/02_core_features/structured_output.dart example/02_core_features/tool_calling.dart ``` -------------------------------- ### Run HTTP Backend Hint Mapping Demo Source: https://github.com/latias94/llm_dart/blob/main/packages/llm_dart_chat/README.md Execute the self-contained in-process demo for HTTP backend hint mapping using the Dart CLI. ```bash dart run example/http_backend_hint_mapping.dart ``` -------------------------------- ### Run streaming LLM example Source: https://github.com/latias94/llm_dart/blob/main/example/06_mcp_integration/http_examples/README.md Execute the streaming LLM client script for streaming text generation, demonstrating tool-input and tool-call events. Ensure the OPENAI_API_KEY environment variable is set. ```bash export OPENAI_API_KEY="your-key-here" dart run http_examples/simple_stream_client.dart ``` -------------------------------- ### Analyze Core Features Example Source: https://github.com/latias94/llm_dart/blob/main/docs/workstreams/2026-05-root-legacy-prompt-options-breaking-line/TODO.md Analyzes the code in the 'example/02_core_features' directory. This command helps identify potential issues and ensure code quality. ```bash dart analyze example/02_core_features ``` -------------------------------- ### Run Example API Guards Check with Suppressed Analytics Source: https://github.com/latias94/llm_dart/blob/main/docs/workstreams/2026-05-core-seam-fearless-refactor/EVIDENCE_AND_GATES.md Executes the example API guards check, suppressing analytics. ```powershell dart --suppress-analytics run tool\check_example_api_guards.dart ```