Favicon of Ollama JavaScript

Ollama JavaScript

A JavaScript client connects apps to local Ollama models or its cloud, with streaming responses, embeddings and an MIT license.

Ollama JavaScript is a library for developers adding model chat, generation or retrieval features to JavaScript applications. It connects those applications to an Ollama server, including one running locally.

  • Chat and generation: Receive streamed answers, include images in prompts, and request JSON output; thinking controls depend on model support.
  • Embeddings: Generate text embeddings for application search and retrieval features using an Ollama model.
  • Model management: Download, inspect, copy and delete models, or create derivatives with custom prompts and LoRA adapters.
  • Web access: Search the web through an Ollama account and API key, or fetch web pages through the client's web-fetch capability.
  • Structured evaluation: Use System One with a compatible local model such as nimble to answer choice and probability questions in one JSON response; this capability doesn't support streaming or cloud models.

The library is open source under the MIT license. Its API follows Ollama's REST interface, and the client can target a chosen Ollama server.

Local model requests go to that server. Cloud model inference runs on Ollama's infrastructure, even when requests pass through a local Ollama instance. Cloud access requires sign-in for the local route or an API key for direct access to the hosted API. The client's model-creation API doesn't support the files parameter.

Similar to Ollama JavaScript