Skip to main content
POST
/
v1
/
embeddings
Embeddings
curl --request POST \
  --url https://llm.ai-nebula.com/v1/embeddings \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "input": {},
  "encoding_format": "<string>",
  "dimensions": 123
}
'
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0023064255, -0.009327292, 0.015797347, ...]
    }
  ],
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 5,
    "total_tokens": 5
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.openai-nebula.com/llms.txt

Use this file to discover all available pages before exploring further.

Introduction

Convert text to vector embeddings for semantic search, similarity calculation, and clustering.

Authentication

Authorization
string
required
Bearer Token, e.g. Bearer sk-xxxxxxxxxx

Request Parameters

model
string
required
Model name, e.g. text-embedding-3-small, text-embedding-3-large
input
string | array
required
Text to embed, string or array of strings
encoding_format
string
default:"float"
Return format: float or base64
dimensions
integer
Output dimensions (supported by some models)

cURL Example

curl https://llm.ai-nebula.com/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-XyLy**************************mIqSt" \
  -d '{
    "model": "text-embedding-3-small",
    "input": "Hello, world"
  }'

Python Example

from openai import OpenAI

client = OpenAI(
    api_key="sk-XyLy**************************mIqSt",
    base_url="https://llm.ai-nebula.com/v1"
)

response = client.embeddings.create(
    model="text-embedding-3-small",
    input="Hello, world"
)

print(response.data[0].embedding)
print(f"Dimensions: {len(response.data[0].embedding)}")
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0023064255, -0.009327292, 0.015797347, ...]
    }
  ],
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 5,
    "total_tokens": 5
  }
}

Supported Models

ModelDimensionsDescription
text-embedding-3-small1536Cost-effective for most use cases
text-embedding-3-large3072High precision for demanding applications
text-embedding-ada-0021536Legacy model

Notes

  • For batch embedding, pass an array of strings to input
  • Some models support custom dimensions via dimensions parameter
  • Requires openai library: pip install openai