Embeddings API
Embeddings
Vectors for semantic search, clustering, recommendations and RAG.
POSThttps://api.oxyy.ai/v1/embeddings
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Required | An embedding model id, e.g. text-embedding-3-large. |
| input | string|array | Required | One string, or a batch of up to 2,048. The batch is capped at 2,000,000 characters in total. |
| encoding_format | string | Optional | One of:floatbase64 Default float |
| dimensions | integer | Optional | Truncate the vector, on models that support shortening. |
| user | string | Optional | A 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 }
}