API Reference
Embeddings
Convert text into vector representations.
Embeddings convert text into vectors for retrieval, clustering, similarity search and RAG.
Endpoint
| Method | Path | Description |
|---|---|---|
POST | /v1/embeddings | Create text embeddings |
Request Fields
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Embedding model ID |
input | string or array | Yes | Text to embed. Send one string or an array of strings |
encoding_format | string | No | Return encoding such as float or base64, depending on model support |
dimensions | integer | No | Target vector dimensions, depending on model support |
user | string | No | User identifier |
seed, temperature, top_p | number | No | Extension fields accepted by some compatible channels |
frequency_penalty, presence_penalty | number | No | Extension fields accepted by some compatible channels |
curl
curl https://api.tensoraxis.com/v1/embeddings \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TENSORAXIS_API_KEY" \
-d '{
"model": "text-embedding-3-small",
"input": ["First text", "Second text"]
}'Python
from openai import OpenAI
client = OpenAI(
api_key="your-tensoraxis-api-key",
base_url="https://api.tensoraxis.com/v1",
)
response = client.embeddings.create(
model="text-embedding-3-small",
input="TENSORAXIS API",
)
print(response.data[0].embedding[:5])Response Shape
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.0123, -0.0456]
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}