Skip to main content
Generate vector representations of text using the OpenAI-compatible embeddings endpoint. The same API key you use for chat and responses works for embeddings.
The embeddings endpoint uses the same API key and authentication as all other gateway endpoints. No additional configuration is required.

Endpoint

POST /v1/embeddings
Base URL: https://api.lightweight.one Include an Authorization: Bearer YOUR_API_KEY header with every request.

Supported Models

ModelDefault DimensionsConfigurableMax Input Tokens
text-embedding-3-small15361-1536 via dimensions8,192
text-embedding-ada-0021536No8,192
text-embedding-3-small is recommended for new projects. It supports configurable output dimensions for smaller, faster vectors. text-embedding-ada-002 is a legacy model.

Request Parameters

ParameterTypeRequiredDescription
modelstringYesModel ID (see Supported Models above)
inputstring or string[]YesText to embed. Single string or array of strings (max 2,048 items per batch). Also accepts number[] (pre-tokenized) and number[][] (batch pre-tokenized).
dimensionsintegerNoOutput dimensions (only for text-embedding-3-small, range 1-1536)
encoding_formatstringNo"float" (default) or "base64"
userstringNoEnd-user identifier for abuse monitoring

Examples

curl -s -X POST https://api.lightweight.one/v1/embeddings \
  -H "Authorization: Bearer $LIGHTWEIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": "The quick brown fox jumps over the lazy dog"
  }'

Response Format

{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "embedding": [0.0023064255, -0.009327292, 0.015462338, "...1536 floats total"],
      "index": 0
    }
  ],
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 9,
    "total_tokens": 9
  }
}
FieldDescription
objectAlways "list"
dataArray of embedding objects
data[].objectAlways "embedding"
data[].embeddingFloat array (default) or base64 string (when encoding_format: "base64")
data[].indexInteger matching the input order
modelThe model used
usage.prompt_tokensNumber of tokens in the input
usage.total_tokensSame as prompt_tokens (embeddings have no output tokens)

Limits

  • Maximum 8,192 tokens per input string
  • Maximum 2,048 items per batch request
  • Maximum 300,000 total tokens per request

Preview Environment

For testing, use the preview gateway at https://preview.api.lightweight.one. Replace the base URL in your requests to route through the preview environment.