Skip to main content
Run large language models with Ollama through a local Ollama server or the direct Ollama Cloud API. Ollama also supports cloud-offloaded models through a signed-in local Ollama server. That access mode uses model IDs such as gpt-oss:120b-cloud. See the Ollama Cloud guide. Ollama supports multiple open-source models. See the Ollama library. Experiment with different models to find the best fit for your use case. Here are some general recommendations:
  • gpt-oss:120b is a general-purpose model available through the direct Ollama Cloud API.
  • llama3.3 models are good for most basic use cases.
  • qwen models perform particularly well with tool use.
  • deepseek-r1 models have strong reasoning capabilities.
  • phi4 models offer strong performance at a small size.

Direct Ollama Cloud API authentication

To call Ollama Cloud directly, set your OLLAMA_API_KEY environment variable. Create a key from Ollama.
When OLLAMA_API_KEY is set, Agno adds bearer authorization and defaults the host to https://ollama.com. Local requests use the Ollama server configured by the client.

Set up a model

Both local and direct cloud usage require the ollama Python package:

Local Usage

Install the Ollama app and run a model:
run model
This starts an interactive session with the model. To download the model for use in an Agno agent:
pull model

Direct Ollama Cloud API

Set OLLAMA_API_KEY to access models through https://ollama.com. This direct API path runs without a local Ollama server.

Examples

Local Usage

Once the model is available locally, use the Ollama model class to access it:

Direct Ollama Cloud API

When OLLAMA_API_KEY is set, the host defaults to https://ollama.com. You can omit the host parameter.
See Ollama usage examples for more.

Params

Ollama is a subclass of the Model class and has access to the same params.

Responses API

Ollama v0.13.3+ supports the OpenAI Responses API via the /v1/responses endpoint. Use OllamaResponses for this interface. It uses the OpenAI client, so install the openai package:
The Responses API is stateless. Each request is independent with no previous_response_id chaining. See OllamaResponses reference for full parameters.