- Docs
- API reference
- Embeddings
Embeddings
POST
https://api.airoutly.com/v1/embeddingsTurn text into vectors for search and retrieval. Compatible with the OpenAI Embeddings API.
Check the models page firstUse an embedding model ID listed on the models page. If none is listed yet, this endpoint has no model to call.
Request body
| Parameter | Description |
|---|---|
modelstringrequired | An embedding model ID from the models page. |
inputstring | arrayrequired | One text, or an array of texts to embed in one request. |
dimensionsinteger | Output vector size, on models that support shortening. |
Example request
curl https://api.airoutly.com/v1/embeddings \
-H "Authorization: Bearer $AIROUTLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "EMBEDDING_MODEL_ID", "input": ["first text", "second text"]}'import os
from openai import OpenAI
client = OpenAI(base_url="https://api.airoutly.com/v1", api_key=os.environ["AIROUTLY_API_KEY"])
res = client.embeddings.create(model="EMBEDDING_MODEL_ID", input=["first text", "second text"])
print(len(res.data[0].embedding))Response
200 OK
{
"object": "list",
"data": [
{ "object": "embedding", "index": 0, "embedding": [0.0123, -0.0456, …] },
{ "object": "embedding", "index": 1, "embedding": [0.0789, 0.0012, …] }
],
"model": "EMBEDDING_MODEL_ID",
"usage": { "prompt_tokens": 6, "total_tokens": 6 }
}Embeddings are billed on input tokens only.