> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Ollama Responses

> Configure OllamaResponses, Agno's model class for Ollama's OpenAI-compatible Responses API.

Interact with Ollama models using the OpenAI Responses API. This uses Ollama's OpenAI-compatible `/v1/responses` endpoint, added in Ollama v0.13.3.

## Requirements

* Ollama v0.13.3 or later
* For local usage: Ollama server running at `http://localhost:11434`
* For Ollama Cloud: Set `OLLAMA_API_KEY` environment variable

```bash theme={null}
uv pip install -U agno openai
```

## Key Features

* **Dual Deployment**: Run locally for privacy or use Ollama Cloud for scalability
* **Auto-configuration**: When using an API key, the host automatically defaults to Ollama Cloud
* **Stateless API**: Each request is independent (no `previous_response_id` chaining)

## Parameters

| Parameter | Type | Default | Description |
| - | - | - | - |
| `id` | `str` | `"gpt-oss:20b"` | The ID of the Ollama model to use |
| `name` | `str` | `"OllamaResponses"` | The name of the model |
| `provider` | `str` | `"Ollama"` | The provider of the model |
| `host` | `Optional[str]` | `None` | The Ollama server host (defaults to `http://localhost:11434`) |
| `api_key` | `Optional[str]` | `None` | The API key for Ollama Cloud (defaults to OLLAMA\_API\_KEY env var, not required for local) |

`OllamaResponses` extends [OpenResponses](https://agno-v2.mintlify.site/reference/models/open-responses.md) and accepts all of its parameters.

## Usage

### Local Usage

```python theme={null}
from agno.agent import Agent
from agno.models.ollama import OllamaResponses

agent = Agent(
    model=OllamaResponses(id="gpt-oss:20b"),
    markdown=True,
)

agent.print_response("Share a 2 sentence horror story")
```

### Ollama Cloud

Set the `OLLAMA_API_KEY` environment variable:

```bash theme={null}
export OLLAMA_API_KEY=your-api-key
```

```python theme={null}
from agno.agent import Agent
from agno.models.ollama import OllamaResponses

agent = Agent(
    model=OllamaResponses(id="gpt-oss:20b"),
    markdown=True,
)

agent.print_response("Share a 2 sentence horror story")
```

### Custom Host

```python theme={null}
from agno.agent import Agent
from agno.models.ollama import OllamaResponses

agent = Agent(
    model=OllamaResponses(
        id="gpt-oss:20b",
        host="http://my-ollama-server:11434",
    ),
    markdown=True,
)

agent.print_response("Hello!")
```

## Developer Resources

* [Ollama Responses API Documentation](https://docs.ollama.com/api/openai-compatibility)
* [Ollama](https://agno-v2.mintlify.site/reference/models/ollama.md) (Chat Completion API)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.