Skip to main content

Embeddings

Creates an embedding vector representing the input text.

POST /v1/inference/embeddings

Get vector embeddings for text (OpenAI-compatible).

Request Headers

Content-Type: "application/json"
Authorization: Bearer GRAVIXLAYER_API_KEY

Example Usage

embeddings.sh
curl https://api.gravixlayer.com/v1/inference/embeddings \
-H "Authorization: Bearer $GRAVIXLAYER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Why is the sky blue?",
"model": "llama3.1:8b-instruct-fp16"
}'

Response

The API returns a JSON response with the following structure:

{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [
0.0023064255,
-0.009327292,
-0.0028842222,
"... (1536 floats total for text-embedding-ada-002)"
],
"index": 0
}
],
"model": "llama3.1:8b-instruct-fp16",
"usage": {
"prompt_tokens": 5,
"total_tokens": 5
}
}