Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Ollama JavaScript library
| Date | Stars |
|---|---|
| 2026-07-31 | 4327 |
| 2026-08-01 | 4328 |
| 2026-08-02 | 4328 |
| 2026-08-03 | 4328 |
| 2026-08-04 | 4330 |
| 2026-08-05 | 4331 |
| 2026-08-06 | 4333 |
Today
+2 stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# Ollama JavaScript Library
The Ollama JavaScript library provides the easiest way to integrate your JavaScript project with [Ollama](https://github.com/jmorganca/ollama).
## Getting Started
```
npm i ollama
```
## Usage
```javascript
import ollama from 'ollama'
const response = await ollama.chat({
model: 'llama3.1',
messages: [{ role: 'user', content: 'Why is the sky blue?' }],
})
console.log(response.message.content)
```
### Browser Usage
To use the library without node, import the browser module.
```javascript
import ollama from 'ollama/browser'
```
## Streaming responses
Response streaming can be enabled by setting `stream: true`, modifying function calls to return an `AsyncGenerator` where each part is an object in the stream.
```javascript
import ollama from 'ollama'
const message = { role: 'user', content: 'Why is the sky blue?' }
const response = await ollama.chat({
model: 'llama3.1',
messages: [message],
stream: true,
})
for await (const part of response) {
process.stdout.write(part.message.content)
}
```
## Cloud Models
Run larger models by offloading to Ollama’s cloud while keeping your local workflow.
[You can see models currently available on Ollama's cloud here.](https://ollama.com/search?c=cloud)
### Run via local Ollama
1) Sign in (one-time):
```
ollama signin
```
2) Pull a cloud model:
```
ollama pull gpt-oss:120b-cloud
```
3) Use as usual (offloads automatically):
```javascript
import { Ollama } from 'ollama'
const ollama = new Ollama()
const response = await ollama.chat({
model: 'gpt-oss:120b-cloud',
messages: [{ role: 'user', content: 'Explain quantum computing' }],
stream: true,
})
for await (const part of response) {
process.stdout.write(part.message.content)
}
```
### Cloud API (ollama.com)
Access cloud models directly by pointing the client at `https://ollama.com`.
1) Create an [API key](https://ollama.com/settings/keys), then set the `OLLAMA_API_KEY` environment variable:
```
export OLLAMA_API_KEY=your_api_key
```
2) Generate a response via the cloud API:
```javascript
import { Ollama } from 'ollama'
const ollama = new Ollama({
host: 'https://ollama.com',
headers: { Authorization: 'Bearer ' + process.env.OLLAMA_API_KEY },
})
const response = await ollama.chat({
model: 'gpt-oss:120b',
messages: [{ role: 'user', content: 'Explain quantum computing' }],
stream: true,
})
for await (const part of response) {
process.stdout.write(part.message.content)
}
```
## API
The Ollama JavaScript library's API is designed around the [Ollama REST API](https://github.com/jmorganca/ollama/blob/main/docs/api.md)
### chat
```javascript
ollama.chat(request)
```
- `request` `<Object>`: The request object containing chat parameters.
- `model` `<string>` The name of the model to use for the chat.
- `messages` `<Message[]>`: Array of message objects representing the chat history.
- `role` `<string>`: The role of the message sender ('user', 'system', or 'assistant').
- `content` `<string>`: The content of the message.
- `images` `<Uint8Array[] | string[]>`: (Optional) Images to be included in the message, either as Uint8Array or base64 encoded strings.
- `tool_name` `<string>`: (Optional) Add the name of the tool that was executed to inform the model of the result
- `format` `<string>`: (Optional) Set the expected format of the response (`json`).
- `stream` `<boolean>`: (Optional) When true an `AsyncGenerator` is returned.
- `think` `<boolean | "high" | "medium" | "low">`: (Optional) Enable model thinking. Use `true`/`false` or specify a level. Requires model support.
- `logprobs` `<boolean>`: (Optional) Return log probabilities for tokens. Requires model support.
- `top_logprobs` `<number>`: (Optional) Number of top log probabilities to return per token when `logprobs` is enabled.
- `keep_alive` `<string | number>`: (Optional) How long to keep the model loaded. A number (seconds) or a string with a duration unit suffix ("300msExcerpt of 11,808 characters
Read on GitHubBruce MacDonald · @ollama
93
31
Jeffrey Morgan · @ollama
15
Parth Sareen · @ollama
12
Michael Yang
11
nicole pardal · Canada
6
Devon Rifkin
5
3
3
2
2
2
Abdulrahman Goni
2
markthree · China
1
Sean Gallen · Israel
1
lif
1
1
1
Michael Dawson · Canada
1
1
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:538691676bc5d1ef, llm:Repository description: 'Ollama JavaScript library'; topics: javascript, js, ollama. Likely a client library for interacting with Ollama (language model) tools/serving.
matched fp:538691676bc5d1ef, llm:Repository description: 'Ollama JavaScript library'; topics: javascript, js, ollama. Likely a client library for interacting with Ollama (language model) tools/serving.