| name | google-adk-models |
| description | Use non-Gemini models with ADK agents via LiteLLM or Anthropic. Use when wiring Claude, GPT-4, Llama, Mistral, or any LiteLLM-supported provider into an ADK agent. |
Google ADK — Models (Non-Gemini)
Overview
ADK's model field accepts either a string (Gemini models) or a BaseLlm instance (any other provider via LiteLLM).
| Provider | Model String Pattern | Install |
|---|
| Gemini (native) | "gemini-2.5-flash" | pip install google-adk |
| Any via LiteLLM | LiteLlm(model="provider/model") | pip install google-adk[extensions] |
Install LiteLLM Support
pip install google-adk[extensions]
Using LiteLLM (Any Provider)
from google.adk.agents import Agent
from google.adk.models.lite_llm import LiteLlm
agent = Agent(
name="claude_agent",
model=LiteLlm(model="anthropic/claude-sonnet-4-20250514"),
instruction="You are a helpful assistant.",
tools=[my_tool],
)
Provider-Specific Examples
Anthropic (Claude)
import os
os.environ["ANTHROPIC_API_KEY"] = "sk-..."
agent = Agent(
name="claude_agent",
model=LiteLlm(model="anthropic/claude-sonnet-4-20250514"),
instruction="...",
)
OpenAI (GPT)
import os
os.environ["OPENAI_API_KEY"] = "sk-..."
agent = Agent(
name="gpt_agent",
model=LiteLlm(model="openai/gpt-4o"),
instruction="...",
)
Azure OpenAI
import os
os.environ["AZURE_API_KEY"] = "..."
os.environ["AZURE_API_BASE"] = "https://your-resource.openai.azure.com/"
os.environ["AZURE_API_VERSION"] = "2024-02-01"
agent = Agent(
name="azure_agent",
model=LiteLlm(model="azure/gpt-4o-deployment-name"),
instruction="...",
)
Vertex AI (Claude via Google Cloud)
import os
os.environ["VERTEXAI_PROJECT"] = "your-gcp-project-id"
os.environ["VERTEXAI_LOCATION"] = "us-east5"
agent = Agent(
name="vertex_claude",
model=LiteLlm(model="vertex_ai/claude-3-7-sonnet@20250219"),
instruction="...",
)
Ollama (Local Models)
agent = Agent(
name="local_agent",
model=LiteLlm(model="ollama/llama3.1"),
instruction="...",
)
Additional LiteLLM Arguments
Pass extra kwargs to customize the LiteLLM completion call:
agent = Agent(
name="custom_agent",
model=LiteLlm(
model="anthropic/claude-sonnet-4-20250514",
temperature=0.7,
max_tokens=4096,
drop_params=True,
),
instruction="...",
)
Default Model for All Agents
from google.adk.agents import LlmAgent
from google.adk.models.lite_llm import LiteLlm
LlmAgent.set_default_model(LiteLlm(model="openai/gpt-4o"))
Multi-Model Systems
from google.adk.agents import Agent
from google.adk.models.lite_llm import LiteLlm
router = Agent(
name="router",
model="gemini-2.5-flash",
instruction="Route requests to the appropriate specialist.",
sub_agents=[fast_agent, smart_agent],
)
fast_agent = Agent(
name="fast_worker",
model="gemini-2.5-flash",
instruction="Handle simple tasks quickly.",
)
smart_agent = Agent(
name="smart_worker",
model=LiteLlm(model="anthropic/claude-sonnet-4-20250514"),
instruction="Handle complex reasoning tasks.",
)
Gemini Models (Native — No LiteLlm Needed)
| Model | Use Case |
|---|
"gemini-2.5-flash" | Fast, cost-effective (default) |
"gemini-2.5-pro" | Complex reasoning |
"gemini-2.0-flash" | Legacy |
Key Rules
- Gemini models use plain strings:
model="gemini-2.5-flash"
- All other providers use
LiteLlm(model="provider/model-name")
- Environment variables for auth must be set BEFORE creating the agent
- LiteLLM model strings follow the
"provider/model" convention
- Don't use LiteLLM for Gemini models — ADK warns against this (use native strings)
drop_params=True silently ignores unsupported params (useful for cross-provider code)
Related Skills
google-adk-llm-agent — Agent configuration (where model is set)
google-adk-deploy — Deploying with non-Gemini models (env vars in secrets)