Generate vector embeddings for semantic search, RAG, clustering, and classification. OpenAI-compatible endpoint.
POST https://api.agilecloud.ai/v1/embeddings
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model name or alias (e.g., text-embedding-3-small) |
| input | string | array | Yes | Text string or array of strings to embed |
curl https://api.agilecloud.ai/v1/embeddings \
-H "Authorization: Bearer $DIRECTAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-small",
"input": "ACAI provides continuous compliance AI inference."
}'Response
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.0123, -0.0456, 0.0789, ...]
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}Pass an array of strings to embed multiple texts in a single request. The server uses dynamic batching to maximize throughput.
curl https://api.agilecloud.ai/v1/embeddings \
-H "Authorization: Bearer $DIRECTAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-small",
"input": [
"First document text",
"Second document text",
"Third document text"
]
}'The response data array will contain one embedding per input, in the same order.
from openai import OpenAI
client = OpenAI(
base_url="https://api.agilecloud.ai/v1",
api_key="YOUR_API_KEY",
)
response = client.embeddings.create(
model="text-embedding-3-small",
input=["Hello, world!", "Another sentence"],
)
for item in response.data:
print(f"Index {item.index}: {len(item.embedding)} dimensions")