Embeddings API

Embeddings

Vectors for semantic search, clustering, recommendations and RAG.

POSThttps://api.oxyy.ai/v1/embeddings

Parameters

ParameterTypeRequiredDescription
modelstringRequiredAn embedding model id, e.g. text-embedding-3-large.
inputstring|arrayRequiredOne string, or a batch of up to 2,048. The batch is capped at 2,000,000 characters in total.
encoding_formatstringOptionalOne of:floatbase64 Default float
dimensionsintegerOptionalTruncate the vector, on models that support shortening.
userstringOptionalA stable id for your own end user.

Code examples

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["OXYY_API_KEY"],
    base_url="https://api.oxyy.ai/v1"
)

# `input` takes one string or a batch of up to 2048.
response = client.embeddings.create(
    model="text-embedding-3-large",
    input=["The quick brown fox", "jumps over the lazy dog"],
    encoding_format="float",
    dimensions=1024,
)

for item in response.data:
    print(item.index, len(item.embedding))
curl https://api.oxyy.ai/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OXYY_API_KEY" \
  -d '{
    "model": "text-embedding-3-large",
    "input": "The quick brown fox",
    "encoding_format": "float"
  }'

Example response

Response
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0023, -0.0091, 0.0156, -0.0042, "..."]
    }
  ],
  "model": "text-embedding-3-large",
  "usage": { "prompt_tokens": 8, "total_tokens": 8, "cost": 0.0000011 }
}

Available models