Ollama API
  1. Generate Embeddings
Ollama API
  • Endpoints
  • Conventions
  • Generate a completion
    • Overview
    • Generate request (Streaming)
      POST
    • Request (No streaming)
      POST
    • Request (with suffix)
      POST
    • Request (Structured outputs)
      POST
    • Request (JSON mode)
      POST
    • Request (with images)
      POST
    • Request (Raw Mode)
      POST
    • Request (Reproducible outputs)
      POST
    • Generate request (With options)
      POST
    • Load a model
      POST
    • Unload a model
      POST
  • Generate a chat completion
    • Overview
    • Chat Request (Streaming)
      POST
    • Chat request (No streaming)
      POST
    • Chat request (Structured outputs)
      POST
    • Chat request (With History)
      POST
    • Chat request (with images)
      POST
    • Chat request (Reproducible outputs)
      POST
    • Chat request (with tools)
      POST
    • Load a model
      POST
    • Unload a model
      POST
  • Create a Model
    • Overview
    • Create a new model
    • Quantize a model
    • Create a model from GGUF
    • Create a model from a Safetensors directory
  • Check if a Blob Exists
    • Overview
  • Push a Blob
    • Overview
  • List Local Models
    • Overview
    • Examples
  • Show Model Information
    • Overview
    • Examples
  • Copy a Model
    • Overview
    • Examples
  • Delete a Model
    • Overview
    • Examples
  • Pull a Model
    • Overview
    • Examples
  • Push a Model
    • Overview
  • Generate Embeddings
    • Overview
    • Examples
      POST
    • Request (Multiple input)
      POST
  • List Running Models
    • Overview
    • Examples
  • Generate Embedding
    • Overview
    • Examples
  • Version
    • Overview
  1. Generate Embeddings

Request (Multiple input)

POST
http://localhost:11434/api/embed
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://localhost:11434/api/embed' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gpt-4",
    "input": [
        "What'\''s the weather like today?",
        "What is the temperature in Beijing now?"
    ]
}'
Response Response Example
{
  "model": "all-minilm",
  "embeddings": [
    [
      0.010071029,
      -0.0017594862,
      0.05007221,
      0.04692972,
      0.054916814,
      0.008599704,
      0.105441414,
      -0.025878139,
      0.12958129,
      0.031952348
    ],
    [
      -0.0098027075,
      0.06042469,
      0.025257962,
      -0.006364387,
      0.07272725,
      0.017194884,
      0.09032035,
      -0.051705178,
      0.09951512,
      0.09072481
    ]
  ]
}

Request

Body Params application/json
model
string 
required
Example:
gpt-4
input
array[string]
required
List of query questions entered
Example:
["What's the weather like today?","What is the temperature in Beijing now?"]
Examples

Responses

🟢200Success
application/json
Body
model
string 
required
embeddings
array [array] 
required
number 
optional
Modified at 2025-03-28 02:55:38
Previous
Examples
Next
Overview
Built with