Nbility logoNbility Docs

Search documentation

Search guides and API reference content

POST /v1/embeddings converts text into vectors for semantic search, clustering, recommendations, and RAG retrieval.

Request

curl https://api.nbility.ai/v1/embeddings \
  -H "Authorization: Bearer $NBILITY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "YOUR_EMBEDDING_MODEL",
    "input": [
      "An API gateway centralizes authentication, routing, and billing.",
      "A vector database performs similarity search."
    ],
    "encoding_format": "float"
  }'

Fields

FieldTypeRequiredDescription
modelstringyesEmbedding model ID
inputstring | string[]yesOne text or a batch of texts
encoding_formatstringnoCommonly float; other formats are model-dependent
dimensionsintegernoOutput dimensions; only some models support dimension reduction
userstringnoEnd-user identifier

Items in data correspond to the input order:

{
  "object": "list",
  "data": [
    {"object": "embedding", "index": 0, "embedding": [0.012, -0.034]}
  ],
  "model": "YOUR_EMBEDDING_MODEL",
  "usage": {"prompt_tokens": 8, "total_tokens": 8}
}

The example vector is truncated.

Operational guidance

  • Index and query with the same model, dimensions, and normalization strategy.
  • Batching reduces network overhead, but keep request size and texts per batch bounded.
  • Vectors from different models are not directly comparable. Rebuild the index or use dual indexes during migration.
  • Avoid logging source text that contains private data; redact it first when needed.