list_ollama_models()

Query Ollama for available models and return their profiles.

Usage

Source

list_ollama_models(
    url=None,
    *,
    timeout=5.0,
)

Connects to the Ollama API, retrieves the list of pulled models with their metadata, and returns ModelProfile instances for each.

Parameters

url: str | None = None

Base URL for the Ollama API. Defaults to http://localhost:11434 or the OLLAMA_HOST environment variable.

timeout: float = 5.0
Connection timeout in seconds.

Returns

list[ModelProfile]
A profile for each model available in Ollama. Returns an empty list if Ollama is not reachable.

Examples

import talk_box as tb

models = tb.list_ollama_models()
for m in models:
    print(f"{m.model}: {m.context_window:,} tokens, tools={m.supports_tools}")