---
title: "embeddings.js — Brad Jasper"
description: "Text embeddings from a local model, OpenAI or Mistral behind one function, with caching."
url: https://bradjasper.com/projects/embeddings-js/
---

[← Code](https://bradjasper.com/code/)

# embeddings.js

Archived · 2024 · JavaScript · AI

Not maintained since 2024.

Text embeddings from a local model, OpenAI or Mistral behind one function, with caching.

- [embeddingsjs.themaximalist.com](https://embeddingsjs.themaximalist.com/)
- [Source on GitHub](https://github.com/themaximalist/embeddings.js)

![embeddings.js logo](https://bradjasper.com/_astro/embeddings.MRBn_29U_Z2c83rT.webp)

`await embeddings("Hello World!")` returns an embedding. It ran a small local model by default, switched to OpenAI or Mistral with an API key, and cached results so the same text was never embedded twice.

Part of [ai.js](https://bradjasper.com/projects/ai-js/), which put my AI libraries behind one toolkit.
