---
title: "Generate embeddings"
method: POST
path: "/api/embed"
---

# Generate embeddings

`POST /api/embed`

Creates vector embeddings representing the input text

## Request body

- EmbedRequest
  - `model` string, required — Model name
  - `input` union, required — Text or array of texts to generate embeddings for
    - string
    - string[]
  - `truncate` boolean — If true, truncate inputs that exceed the context window. If false, returns an error.
  - `dimensions` integer — Number of dimensions to generate embeddings for
  - `keep_alive` string — Model keep-alive duration
  - `options` ModelOptions — Runtime options that control text generation
    - `seed` integer — Random seed used for reproducible outputs
    - `temperature` number, float — Controls randomness in generation (higher = more random)
    - `top_k` integer — Limits next token selection to the K most likely
    - `top_p` number, float — Cumulative probability threshold for nucleus sampling
    - `min_p` number, float — Minimum probability threshold for token selection
    - `stop` union — Stop sequences that will halt generation
      - string
      - string[]
    - `num_ctx` integer — Context length size (number of tokens)
    - `num_predict` integer — Maximum number of tokens to generate

## Response `200`

Vector embeddings for the input text

- EmbedResponse
  - `model` string — Model that produced the embeddings
  - `embeddings` array[] — Array of vector embeddings
    - number[]
  - `total_duration` integer — Total time spent generating in nanoseconds
  - `load_duration` integer — Load time in nanoseconds
  - `prompt_eval_count` integer — Number of input tokens processed to generate embeddings

---

[API](https://skmtc.net/ac/apis/ollama-api.md) · [All operations](https://skmtc.net/ac/apis/ollama-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/ac/ollama-api/versions/c2056a7f42d9/schema)
