For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Contact usJoin the Discord
ManualAPI GuideAPI Reference
  • Core API
    • Messages
    • Async messages
    • Embeddings
  • Tools & Skills
    • Built-in Tools
    • Skills
  • Documents
    • Ingestion
    • Async ingestion
LogoLogo
Contact usJoin the Discord
On this page
  • Single input
  • Batch input
  • Choosing a model
Core API

Embeddings

Was this page helpful?
Previous

Built-in Tools

Next
Built with

The Embeddings API (POST /v1/embeddings) converts text into high-dimensional vectors. Use them to build your own semantic search, clustering pipelines, or similarity scoring outside of PrivateGPT’s built-in retrieval.


Single input

$curl -X POST http://localhost:8080/v1/embeddings \
> -H "Content-Type: application/json" \
> -d '{
> "model": "mxbai-embed-large",
> "input": "The quick brown fox jumps over the lazy dog."
> }'

Response:

1{
2 "data": [
3 {"index": 0, "embedding": [0.021, -0.013, ...], "object": "embedding"}
4 ],
5 "model": "mxbai-embed-large",
6 "usage": {"input_tokens": 12, "total_tokens": 12}
7}

Batch input

Pass an array of strings to embed multiple texts in one request. The response preserves input order — data[i] corresponds to input[i]:

$curl -X POST http://localhost:8080/v1/embeddings \
> -H "Content-Type: application/json" \
> -d '{
> "model": "mxbai-embed-large",
> "input": [
> "First document text",
> "Second document text",
> "Third document text"
> ]
> }'

Choosing a model

The model field must match the name of an embedding model registered in your PrivateGPT instance. Use GET /v1/models to list available models and their types.

For consistent similarity results, always use the same model to embed both your corpus and your queries. Mixing models produces incomparable vectors.