# ollama-ai-provider

> Vercel AI Provider for running LLMs locally using Ollama

Latest version **1.2.0** (published 2025-01-17) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install ollama-ai-provider
pnpm add ollama-ai-provider
yarn add ollama-ai-provider
bun add ollama-ai-provider
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2025-01-17 |
| First published | 2024-05-05 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 3 |
| Unpacked size | 157.3 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 340 |
| Author | Sergio Gómez Bachiller |
| Maintainers | sgomez |
| Keywords | ai, vercel-ai |

## Links

- npm: https://www.npmjs.com/package/ollama-ai-provider
- Repository: https://github.com/sgomez/ollama-ai-provider
- Issues: https://github.com/sgomez/ollama-ai-provider/issues
- npm.io page: https://npm.io/package/ollama-ai-provider

## Dependencies (3)

- [partial-json](https://npm.io/package/partial-json.md) 0.1.7
- [@ai-sdk/provider](https://npm.io/package/@ai-sdk/provider.md) ^1.0.0
- [@ai-sdk/provider-utils](https://npm.io/package/@ai-sdk/provider-utils.md) ^2.0.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2025-01-17
- 1.1.0 — 2024-12-06
- 1.0.0 — 2024-11-22
- 0.16.1 — 2024-11-06
- 0.16.0 — 2024-10-27
- 0.15.2 — 2024-10-10
- 0.15.1 — 2024-09-23
- 0.15.0 — 2024-09-13
- 0.14.0 — 2024-09-07
- 0.13.0 — 2024-08-27
- 0.12.1 — 2024-08-22
- 0.12.0 — 2024-08-07
- 0.11.0 — 2024-08-03
- 0.10.0 — 2024-07-07
- 0.9.1 — 2024-06-30
- … 10 more at https://npm.io/package/ollama-ai-provider/versions

## README

# Ollama Provider for the Vercel AI SDK

The **[Ollama Provider](https://github.com/sgomez/ollama-ai-provider)** for the [Vercel AI SDK](https://sdk.vercel.ai/docs)
contains language model support for the Ollama APIs and embedding model support for the Ollama embeddings API.

## Requirements

This provider requires Ollama >= 0.5.0

## Setup

The Ollama provider is available in the `ollama-ai-provider` module. You can install it with

```bash
npm i ollama-ai-provider
```

## Provider Instance

You can import the default provider instance `ollama` from `ollama-ai-provider`:

```ts
import { ollama } from 'ollama-ai-provider';
```

## Example

```ts
import { ollama } from 'ollama-ai-provider';
import { generateText } from 'ai';

const { text } = await generateText({
  model: ollama('phi3'),
  prompt: 'Write a vegetarian lasagna recipe for 4 people.',
});
```

## Documentation

Please check out the **[Ollama provider documentation](https://github.com/sgomez/ollama-ai-provider)** for more information.

---
_Source: https://npm.io/package/ollama-ai-provider · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
