Up to 7.2× the speed of standard llama.cpp Runs 100% on your PC
Free for personal use
Download free

Embeddings

POST/v1/embeddings
Free: not countedBase URL http://localhost:1234/v1
Local API Guide contents

Overview

OpenAI-compatible embeddings from Qwen3-Embedding-4B, the model behind the app's Knowledge search. It runs on the GPU next to the loaded chat model, so a chat model must be loaded. Vectors are 2,560-dimensional and normalised (length 1), so the dot product is the cosine similarity. Embeddings don't count toward your daily allowance.

Request body

ParameterDescription
inputstring | string[]requiredThe text, or up to 2,048 texts in one request. Each must be non-empty.
input_typestringdocument (default) embeds the text as it is. query adds the model's search instruction: use it for search queries, and document for the passages you search through.
instructionstringWith input_type: "query": your own task description instead of the default search instruction.
dimensionsinteger32 to 2,560: shorter vectors (the first n values, normalised again). Smaller indexes, slightly lower quality.
encoding_formatstringfloat (default) or base64 (little-endian float32).
modelstringIgnored: always Qwen3-Embedding-4B.
Authorization headerAuthorization: Bearer <key>, only when Require API key is on in the app.

Response

FieldDescription
objectstringlist
data[].embeddingnumber[] | stringThe vector (or base64), with index matching the input's position.
modelstringqwen3-embedding-4b
usageobjectprompt_tokens and total_tokens.
timings.msnumberTime on the GPU, in milliseconds.

Example

curl http://localhost:1234/v1/embeddings \
  -H "Content-Type: application/json" \
  -d '{"input": ["The RTX 5090 has 32 GB of memory.", "Cats sleep a lot."], "dimensions": 1024}'
Response
{
  "object": "list",
  "data": [
    { "object": "embedding", "index": 0, "embedding": [0.0213, -0.0047, 0.0391, …] },
    { "object": "embedding", "index": 1, "embedding": [-0.0102, 0.0288, 0.0015, …] }
  ],
  "model": "qwen3-embedding-4b",
  "usage": { "prompt_tokens": 17, "total_tokens": 17 },
  "timings": { "ms": 9.6 }
}

Errors

StatusCodeWhen
401invalid_api_keyRequire API key is on and the key is missing or wrong.
400(none)input is empty or has more than 2,048 items, or another parameter is out of range.
503model_not_loadedNo chat model is loaded: the knowledge model runs inside the engine.
500(none)The knowledge model file is missing: download it on the Models page in the app.