Models & Providers
Configure LLM models from Gemini, OpenAI, Anthropic, and other providers with ADK-TS agents
ADK-TS provides flexible model integration, allowing you to use various Large Language Models (LLMs) with your agents. The framework defaults to Google Gemini models but supports extensive customization through two main approaches.
Model Integration Options
ADK-TS supports two primary ways to configure models:
🎯 Option 1: Direct Model Names
Pass model names directly to agents - Gemini is default, others require environment configuration
🔌 Option 2: Vercel AI SDK
Use model instances from Vercel AI SDK for extensive provider support
Option 1: Direct Model Names
The simplest approach - pass model names as strings directly to your agents. ADK-TS defaults to Gemini models but supports other providers when properly configured.
Default: Google Gemini Models
Gemini is the default provider, but you still need to configure your API key:
1. Set up your Google API key:
# .env file
GOOGLE_API_KEY=your_google_api_key_here2. Use Gemini models directly:
import { LlmAgent } from "@iqai/adk";
// Default Gemini models (just need GOOGLE_API_KEY in .env)
const agent = new LlmAgent({
name: "my_agent",
model: "gemini-2.0-flash-exp", // Fast and latest
instruction: "You are a helpful assistant",
});
// Other Gemini models
const fastAgent = new LlmAgent({
name: "fast_agent",
model: "gemini-2.0-flash", // Fast and efficient
});
const powerfulAgent = new LlmAgent({
name: "powerful_agent",
model: "gemini-2.0-pro", // Complex reasoning
});Using Other Providers
To use non-Gemini models, you must configure your environment:
1. Set the model name in your environment:
# .env file
LLM_MODEL=gpt-4o # or claude-3-5-sonnet-20241022, etc.2. Add the corresponding API key:
# .env file
LLM_MODEL=gpt-4o
OPENAI_API_KEY=your_openai_api_key_here
# Or for Claude:
LLM_MODEL=claude-3-5-sonnet-20241022
ANTHROPIC_API_KEY=your_anthropic_api_key_here
# Or for other providers:
LLM_MODEL=llama-3.1-70b-versatile
GROQ_API_KEY=your_groq_api_key_here3. Use the model name in your agent:
import { LlmAgent } from "@iqai/adk";
const agent = new LlmAgent({
name: "my_agent",
model: "gpt-4o", // Must match your .env LLM_MODEL
instruction: "You are a helpful assistant",
});Environment Configuration Required
- Gemini models (default): Only need
GOOGLE_API_KEYin your environment - Other providers: Must set both
LLM_MODELand the corresponding API key (OPENAI_API_KEY,ANTHROPIC_API_KEY, etc.)
Supported Model Names
| Provider | Example Model Names | Required API Key |
|---|---|---|
| Google Gemini | gemini-2.0-flash, gemini-2.0-pro, gemini-1.5-pro | GOOGLE_API_KEY (default provider) |
| OpenAI | gpt-4o, gpt-4, gpt-3.5-turbo | OPENAI_API_KEY |
| Anthropic | claude-3-5-sonnet-20241022, claude-3-opus | ANTHROPIC_API_KEY |
| Groq | llama-3.1-70b-versatile, mixtral-8x7b | GROQ_API_KEY |
| Mistral | mistral-large-latest, codestral-latest | MISTRAL_API_KEY |
Option 2: Vercel AI SDK Integration
For more control and advanced features, use model instances from the Vercel AI SDK. This approach provides access to multiple providers with consistent APIs and advanced capabilities.
Setup Requirements
1. Install Provider Packages:
# Install the providers you want to use
npm install @ai-sdk/openai # For OpenAI models
npm install @ai-sdk/anthropic # For Anthropic models
npm install @ai-sdk/google # For Google models
npm install @ai-sdk/mistral # For Mistral models
npm install @ai-sdk/groq # For Groq models2. Configure API Keys:
# .env file
OPENAI_API_KEY=your_openai_api_key_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here
GOOGLE_API_KEY=your_google_api_key_here
MISTRAL_API_KEY=your_mistral_api_key_here
GROQ_API_KEY=your_groq_api_key_here3. Use Model Instances:
import { LlmAgent } from "@iqai/adk";
import { openai } from "@ai-sdk/openai";
import { anthropic } from "@ai-sdk/anthropic";
import { google } from "@ai-sdk/google";
import { mistral } from "@ai-sdk/mistral";
import { groq } from "@ai-sdk/groq";
// OpenAI models
const gpt4Agent = new LlmAgent({
name: "gpt4_agent",
model: openai("gpt-4o"),
instruction: "You are a helpful assistant",
});
// Anthropic models
const claudeAgent = new LlmAgent({
name: "claude_agent",
model: anthropic("claude-3-5-sonnet-20241022"),
instruction: "You are a helpful assistant",
});
// Google models via Vercel AI SDK
const geminiAgent = new LlmAgent({
name: "gemini_agent",
model: google("gemini-2.0-flash"),
instruction: "You are a helpful assistant",
});
// Mistral models
const mistralAgent = new LlmAgent({
name: "mistral_agent",
model: mistral("mistral-large-latest"),
instruction: "You are a helpful assistant",
});
// Groq models
const groqAgent = new LlmAgent({
name: "groq_agent",
model: groq("llama-3.1-70b-versatile"),
instruction: "You are a helpful assistant",
});Supported Providers
🤖 OpenAI
GPT-4o, GPT-4, GPT-3.5, and latest ChatGPT models
🧠 Anthropic
Claude 3.5 Sonnet, Claude 3 Opus, and Haiku models
🔥 Mistral
Mistral Large, Codestral, and specialized models
⚡ Groq
Ultra-fast inference for Llama, Mixtral, and Gemma models
🌐 Many Others
Google, Perplexity, Cohere, and other providers
The Vercel AI SDK supports many more providers beyond what's shown here. Check the official documentation for the complete list of supported providers and models.
Local & Open Source Models
Local and open source models (like Ollama, self-hosted models) are also
supported through the Vercel AI SDK approach. Install the appropriate provider
package (@ai-sdk/ollama, etc.) and configure as needed. Note that not all
local models support function calling reliably.
Which Option Should You Choose?
| Use Case | Recommended Option | Why |
|---|---|---|
| Getting Started | Option 1 (Gemini default) | Simple setup, just need GOOGLE_API_KEY |
| Production Apps | Option 1 with env config | Simple, reliable, fewer dependencies |
| Multi-Provider | Option 2 (Vercel AI SDK) | Unified interface, consistent APIs |
| Advanced Features | Option 2 (Vercel AI SDK) | Streaming, advanced config, type safety |
| Local/Private Models | Option 2 (Vercel AI SDK) | Only option that supports local deployment |
Next Steps
🤖 Create Your First LLM Agent
Learn how to use models with LLM agents and get started building
🔧 Use Agent Builder
Rapidly create agents with the fluent API and model configuration
🛠️ Add Tools to Your Agents
Integrate tools with different model types for enhanced capabilities
👥 Build Multi-Agent Systems
Coordinate multiple agents with different models and specializations
How is this guide?