ADK — Connecting to Other LLMs
ADK is optimized for Gemini, but you can connect to any model via:
- LiteLLM — a package that handles requests across providers.
- OpenRouter — gives you access to any LLM. You pay for credits through OpenRouter, and it provides one API key to access all models.
- Put the API key in the
.envfile. - Rankings: https://openrouter.ai/rankings
- Put the API key in the
Example
import os
from google.adk.models.lite_llm import LiteLlm
model = LiteLlm(
model="openrouter/openai/gpt-4.1",
api_key=os.getenv("OPENROUTER_API_KEY"),
)See next
- ADK-Overview — ADK is model-agnostic by design