ChatBase and exposes the same four methods, takes the same messages and returns the same ModelResponse. Changing provider is changing one line.
Providers
Anthropic, Google and Mistral use their native SDKs; the others speak the OpenAI Chat Completions format. Every client accepts
api_key= to pass the key directly, and timeout and retry settings for its SDK.
OpenAI and compatible servers
ChatOpenAI takes the usual sampling parameters (temperature, top_p, max_completion_tokens, seed, stop, presence_penalty, frequency_penalty, logprobs…), reasoning_effort for reasoning models and prompt_cache_key. With base_url it talks to any OpenAI-compatible server: vLLM, LM Studio, Scaleway, a gateway.
Anthropic
thinking turns on extended thinking; see Reasoning.
Azure OpenAI
azure_endpoint, azure_deployment and api_version fall back on AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_DEPLOYMENT and AZURE_OPENAI_API_VERSION.
Ollama and local models
ChatOllama extracts the <think>...</think> blocks local reasoning models write inline into separate thinking parts.
Gwenlake
ChatGwenlake calls the models served by Gwenlake, at https://integrate.api.gwenlake.com/v1 by default. It reads GWENLAKE_API_KEY, and GWENLAKE_ORGANIZATION when set.
Calling a model
await llm.aclose() to release the async HTTP client when you are done with it.
Structured answers
Setresponse_format to a Pydantic model and response.parsed holds the validated object:
response_model instead: it also works while tools are on offer. See Structured output.
Context window
The agent keeps its history within the model’s context window, so it needs to know it.llm.context_window_info() tells the size and where it comes from, resolved in this order:
context_window=<int>: an explicit value, for instance a vLLM server started with a smaller--max-model-len;context_window="auto": read from the server’s/modelslisting (max_model_len,context_lengthorcontext_window) on OpenAI-compatible clients;- the built-in table of known models (
gwenflow.llms.models.MODELS), matched without case and without a provider or organisation prefix, soQwen/Qwen3.6-27B-AWQfindsqwen3.6-27b; fallback_context_window=<int>: a value used only for a model found nowhere else;- 128,000 tokens, with a warning logged once.
Addressing models by name
Flows and the command line name a model asprovider/model-name. make_llm builds the client from that string, with any extra keyword argument passed through:
openai, anthropic, google (or gemini), mistral, azure, deepseek, ollama and gwenlake.