Skip to content

DocsAPI reference

Embeddings

POST /v1/embeddings — multilingual text embeddings from Qwen3-Embedding-8B on your own GPU, for search, RAG and clustering.

HTTP
POST https://osarai.xyz/v1/embeddings

Turns text into vectors for semantic search, retrieval-augmented generation and clustering. Deploy Qwen3-Embedding-8B (qwen3-embedding-8b, 4096 dimensions, 32K tokens per input) to use it.

Request

Terminal
curl "https://osarai.xyz/v1/embeddings" \
  -H "Authorization: Bearer $OSARAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3-embedding-8b",
    "input": ["A cat sleeps on the sofa.", "A kitten naps on the couch."]
  }'
FieldNotes
modelqwen3-embedding-8b
inputA string or a list of strings
encoding_formatfloat (default) or base64

Request bodies can be up to 8 MiB; send large corpora in batches.

Response

JSON
{
  "object": "list",
  "model": "qwen3-embedding-8b",
  "data": [
    { "object": "embedding", "index": 0, "embedding": [0.0123, -0.0456, 0.0789] },
    { "object": "embedding", "index": 1, "embedding": [0.0119, -0.0441, 0.0802] }
  ],
  "usage": { "prompt_tokens": 18, "total_tokens": 18 }
}

Vectors are shortened here; each has 4096 numbers. Compare them with cosine similarity.

Tips

  • For search, Qwen3-Embedding works best when the query carries a one-line task, for example Instruct: Given a question, find passages that answer it\nQuery: how do I reset my password?. Embed the documents as they are.
  • Run the embedding model next to a chat model: with two instances, each request goes to the one that serves its model.
  • To order search hits by relevance, add a reranker (Rerank and score).