Skip to content

Config

VLM API configuration for provider-agnostic VLM inference via litellm.

VLMAPIConfig

Bases: BaseModel

Provider-agnostic VLM API configuration using litellm.

Supports any provider litellm supports: Gemini, OpenRouter, Azure, OpenAI, Anthropic, etc. The model string uses litellm format with provider prefix (e.g., "gemini/gemini-2.5-flash").

API keys can be passed directly or read from environment variables (GOOGLE_API_KEY, OPENROUTER_API_KEY, AZURE_API_KEY, OPENAI_API_KEY, etc.).

Example
# Gemini (reads GOOGLE_API_KEY from env)
config = VLMAPIConfig(model="gemini/gemini-2.5-flash")

# OpenRouter with explicit key
config = VLMAPIConfig(
    model="openrouter/qwen/qwen3-vl-8b-instruct",
    api_key="sk-...",
)

# Azure OpenAI
config = VLMAPIConfig(
    model="azure/gpt-4o",
    api_base="https://my-deployment.openai.azure.com/",
)