Who it is forA developer building semantic search who wants embeddings without paying a hosted embeddings API.
The problemEmbedding a large document set through a paid API costs money and sends every document to a third party.
The outcomeA local endpoint your existing OpenAI client code can call for text, vision or audio embeddings.
What you need first
- uv to install the CLI with uv tool install
- Linux, macOS, Windows or Raspberry Pi for the CLI; Android, iOS or the web through the language APIs
- A LiteRT-LM model, for example from the litert-community Hugging Face repos
Steps
- Install the CLI with
uv tool install litert-lm - Import a model quickly with
litert-lm importif you have one locally - Start
litert-lm servewith a multimodal embedding model such as EmbeddingGemma 2 - Point your OpenAI-compatible client at the local /v1/embeddings endpoint
- Use Matryoshka dimension truncation to store shorter vectors when space matters
Prompt for your agent
Set up google-ai-edge/LiteRT-LM to serve EmbeddingGemma 2 locally with litert-lm serve, then change my <search code> to call the local /v1/embeddings endpoint instead of the hosted API. Embed <sample docs> and show a test query.
Caveat. The serve endpoint is described in the release notes; check the DevSite docs for the exact model names and flags in your version.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for google-ai-edge/LiteRT-LM and "Serve local embeddings through an OpenAI-compatible endpoint"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer