> For the complete documentation index, see [llms.txt](https://dnotifier.gitbook.io/product-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dnotifier.gitbook.io/product-docs/ai/multi-models/ollama-local-integration.md). Agents can also search and read this documentation through its [MCP server](https://dnotifier.gitbook.io/product-docs/~gitbook/mcp).

# Ollama local integration

`provider` value: `ollama`

Ollama is for local / private models — laptop demos, air-gapped boxes, or a box on your VPC. You still configure the **host URL** in the portal; the SDK only says `ollama` + the model tag (`llama3.2`, `mistral`, …).

## Reality check on networking

`http://127.0.0.1:11434` only works if the DNotifier worker that runs AI can reach that address. Cloud workers cannot see your laptop loopback. Options people use:

* run Ollama on a reachable host
* tunnel / VPN per portal instructions
* self-hosted path if you have one

Whatever URL you save in the portal has to answer from the AI runtime.

## Setup

```bash
# on the Ollama machine
ollama pull llama3.2
ollama list
```

**Projects** (pick the project) → **AI Studio** → **Providers** → **Ollama** → paste the base URL → save. Model names in code must match `ollama list`.

## Call

{% tabs %}
{% tab title="JavaScript" %}

```js
await notifier.sendAI({
  senderId: USER_ID,
  provider: "ollama",
  model: "llama3.2",
  message: {
    messages: [{ role: "user", content: "Write a haiku about local LLMs." }],
  },
  saveHistory: false,
});
```

{% endtab %}

{% tab title="Python" %}

```python
await notifier.send_ai(
    sender_id=user_id,
    provider="ollama",
    model="llama3.2",
    message={
        "messages": [{"role": "user", "content": "Write a haiku about local LLMs."}],
    },
    save_history=False,
)
```

{% endtab %}

{% tab title="Dart" %}

```dart
await notifier.sendAI(
  senderId: userId,
  provider: 'ollama',
  model: 'llama3.2',
  message: {
    'messages': [
      {'role': 'user', 'content': 'Write a haiku about local LLMs.'},
    ],
  },
  saveHistory: false,
);
```

{% endtab %}
{% endtabs %}

```js
const localDev = DNotifier.defineAgent({
  name: "local-dev",
  provider: "ollama",
  model: "llama3.2",
  async run(ctx) {
    return ctx.sendAI({
      message: { text: ctx.input.prompt },
      saveHistory: false,
    });
  },
});
```

Keep `saveHistory` off while you're thrashing prompts locally — less junk in history UIs.

Hub-hosted open models instead: [hugging-face-integration.md](https://dnotifier.gitbook.io/product-docs/ai/multi-models/hugging-face-integration.md).
