TypeScriptADK-TS

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_here

2. 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_here

3. 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_KEY in your environment
  • Other providers: Must set both LLM_MODEL and the corresponding API key (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.)

Supported Model Names

ProviderExample Model NamesRequired API Key
Google Geminigemini-2.0-flash, gemini-2.0-pro, gemini-1.5-proGOOGLE_API_KEY (default provider)
OpenAIgpt-4o, gpt-4, gpt-3.5-turboOPENAI_API_KEY
Anthropicclaude-3-5-sonnet-20241022, claude-3-opusANTHROPIC_API_KEY
Groqllama-3.1-70b-versatile, mixtral-8x7bGROQ_API_KEY
Mistralmistral-large-latest, codestral-latestMISTRAL_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 models

2. 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_here

3. 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 CaseRecommended OptionWhy
Getting StartedOption 1 (Gemini default)Simple setup, just need GOOGLE_API_KEY
Production AppsOption 1 with env configSimple, reliable, fewer dependencies
Multi-ProviderOption 2 (Vercel AI SDK)Unified interface, consistent APIs
Advanced FeaturesOption 2 (Vercel AI SDK)Streaming, advanced config, type safety
Local/Private ModelsOption 2 (Vercel AI SDK)Only option that supports local deployment

Next Steps

How is this guide?