Skip to content

Embeddings

Generate text embeddings for semantic search, RAG, and classification. OpenAI-compatible endpoint.

Endpoint

POST /v1/embeddings

Authentication

Include your API key as a Bearer token or X-API-Key header. See Authentication.

Request body

ParameterTypeRequiredDescription
modelstringYesModel ID: all-MiniLM-L6-v2
inputstring or arrayYesText string or array of strings to embed

Request

curl -X POST https://api.ryvion.ai/v1/embeddings \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"all-MiniLM-L6-v2","input":"Hello world"}'
from openai import OpenAI

client = OpenAI(
    base_url="https://api.ryvion.ai/v1",
    api_key="YOUR_KEY",
)

response = client.embeddings.create(
    model="all-MiniLM-L6-v2",
    input="Hello world",
)
print(response.data[0].embedding[:5])  # First 5 dimensions

Response format

{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0123, -0.0456, 0.0789, ...]
    }
  ],
  "model": "all-MiniLM-L6-v2",
  "usage": {
    "prompt_tokens": 2,
    "total_tokens": 2
  }
}

Available models

ModelDimensionsDescription
all-MiniLM-L6-v2384Fast, lightweight sentence embeddings

Batch input

Pass an array to embed multiple texts in one request:

curl -X POST https://api.ryvion.ai/v1/embeddings \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"all-MiniLM-L6-v2","input":["First text","Second text","Third text"]}'

Usage with Knowledge Bases

Embeddings power the Knowledge Base semantic search. When you upload documents to a knowledge base, they are automatically chunked and embedded. You can also use the embeddings endpoint directly for custom search pipelines.

Cryptographic receipts

Every embedding request generates a signed receipt. See Receipts.