Skip to main content
AdOpenFree logoPromote your productReach more potential users and drive product growth and revenue.Advertise
Favicon of Ollama JavaScript Library

Ollama JavaScript Library

Free Listing

Official JavaScript client for Ollama that wraps the Ollama REST API, enabling chat, streaming, embeddings, model management, tool use, and cloud model access in Node and browser apps.

Visit ollama/ollama-js

Overview

Ollama JavaScript Library is the official JavaScript client for Ollama, designed around the Ollama REST API. It exposes methods such as chat, generate, pull, push, create, delete, copy, list, show, embed, webSearch, webFetch, ps, version, abort, and systemone. It works in Node and the browser and supports streaming responses, cloud models, custom hosts and headers, and structured output.

Key Features

  • Chat and generation APIs accept model names and message arrays and return assistant responses.
  • Streaming responses return an AsyncGenerator when stream is set to true.
  • Works in Node and browser, with browser usage available through the ollama/browser module.
  • Cloud model support offloads larger models while keeping the local workflow, and direct ollama.com API access is available with an API key.
  • Supports images, tool names, structured JSON output, thinking levels, log probabilities, and keep_alive controls.
  • Includes model management methods such as pull, push, create, delete, copy, list, show, embed, ps, version, and abort.

Use Cases

  • Integrating JavaScript applications with locally running Ollama models.
  • Streaming model output to a CLI or web client as chunks arrive.
  • Using larger cloud-hosted models from the same JavaScript client without rewriting code.
  • Building browser-based frontends that call Ollama through ollama/browser.

Getting Started

  • Install the package with npm i ollama.
  • Import ollama from ollama and call ollama.chat with a model name and messages array.
  • For browser usage, import ollama from ollama/browser.
  • For cloud models, run ollama signin and ollama pull gpt-oss:120b-cloud, then use the model as usual.

Before You Adopt

  • License: MIT. Review its terms before using, modifying, or distributing the project.
  • Web search depends on an Ollama account.
  • The library recommends one Ollama client per stream when managing stream timeouts.

Comments

Sign in to leave a comment.

More like Ollama JavaScript Library

Favicon of LNDev UI

LNDev UI

Free ListingStars: 4.7K

Open-source shadcn/ui layouts for project management

App UI & SDKs

LNDev UI is an open-source collection of shadcn/ui layouts. It includes a Linear-inspired project management interface built with Next.js and shadcn/ui for tracking issues, projects, and teams.

Favicon of Astryx

Astryx

Free ListingStars: 13.8K

Fully customizable, agent-ready React design system

App UI & SDKs

Astryx is an open source design system with 150+ accessible React components, customizable themes, dark mode, templates, and a CLI that supports both people and AI assistants.

Favicon of Solid Glass

Solid Glass

Free ListingStars: 2.1K

A tactile, physical design system for AI applications.

App UI & SDKs

Solid Glass is a design system for AI applications with a refined glass-inspired aesthetic: thick, smoky panes, fine borders, soft shadows, and restrained finishes that keep interfaces readable while adding depth and materiality.