Generate embeddings with Ollama POST /api/embed (single or batched input) and avoid the legacy /api/embeddings shape

domain: ollama.com · 4 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. POST http://localhost:11434/api/embed with {"model": "all-minilm", "input": "Why is the sky blue?"}. input may also be a list of strings for a batch.
  2. The response is {"model", "embeddings": [[...floats...], ...], plus total_duration, load_duration, prompt_eval_count}. embeddings is always a list of vectors, even for a single input.
  3. Optional params: truncate (default true — trims each input to fit the context window; if false, over-length input returns an error), dimensions (number of dimensions for the embedding), options, keep_alive.
  4. For batches, embeddings[i] corresponds to input[i] in order.

Known gotchas

Related routes

Generate a one-shot (non-streaming) completion from a local Ollama model via POST /api/generate
ollama.com · 5 steps · unrated
Create a customized Ollama model from an existing one with POST /api/create (system prompt, params, quantization)
ollama.com · 5 steps · unrated
Get text embeddings from an OpenAI-compatible server via POST /v1/embeddings
OpenAI-compatible · 4 steps · unrated

Give your agent this knowledge — and 18,200+ more routes

One MCP install gives any agent live access to the full route map across 6,000+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans