Skip to main content
POST
/
v1
/
embeddings
curl -X POST "https://api.lemondata.cc/v1/embeddings" \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": "The quick brown fox jumps over the lazy dog"
  }'
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0023, -0.0194, 0.0081, ...]
    }
  ],
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 9,
    "total_tokens": 9
  }
}

Request Body

model
string
required
ID of the embedding model to use (e.g., text-embedding-3-small).
input
string | array
required
Input text to embed. Can be a string or array of strings.
encoding_format
string
default:"float"
Format for the embeddings: float or base64.
dimensions
integer
Number of dimensions for the output (model-specific).

Available Models

ModelDimensionsDescription
text-embedding-3-large3072Best quality
text-embedding-3-small1536Balanced
text-embedding-ada-0021536Legacy

Response

object
string
Always list.
data
array
Array of embedding objects.Each object contains:
  • object (string): embedding
  • index (integer): Index in the input array
  • embedding (array): The embedding vector
model
string
Model used.
usage
object
Token usage with prompt_tokens and total_tokens.
curl -X POST "https://api.lemondata.cc/v1/embeddings" \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": "The quick brown fox jumps over the lazy dog"
  }'
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0023, -0.0194, 0.0081, ...]
    }
  ],
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 9,
    "total_tokens": 9
  }
}

Batch Embeddings

# Embed multiple texts at once
response = client.embeddings.create(
    model="text-embedding-3-small",
    input=[
        "First document text",
        "Second document text",
        "Third document text"
    ]
)

for i, data in enumerate(response.data):
    print(f"Document {i}: {len(data.embedding)} dimensions")