API reference · Embeddings

Embeddings.

Vectors for retrieval and agent memory, next to your chat calls — same key, same origin. One embedding model: lx1-embed, 768 dimensions, OpenAI-compatible.

Endpoint

POST/v1/embeddings

Authenticate with Authorization: Bearer lx1_.... The embedding model is lx1-embed and produces 768-dimensional vectors.

Request parameters

ParameterTypeNotes
modelstringlx1-embed.
inputstring | string[] · requiredOne text or a batch — up to 2,048 items per request. Token arrays are not supported.
encoding_formatstringfloat (default) or base64.
dimensionsintegerOptional; must be 768 if set — the model has one output size.

Example

curl https://api.layerx1.in/v1/embeddings \
  -H "authorization: Bearer $LAYERX1_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "lx1-embed",
    "input": ["agent memory entry one", "agent memory entry two"]
  }'
Embed a batch of texts
{
  "object": "list",
  "data": [
    { "object": "embedding", "index": 0, "embedding": [0.013, -0.021, ...] },
    { "object": "embedding", "index": 1, "embedding": [0.007,  0.049, ...] }
  ],
  "model": "lx1-embed",
  "usage": { "prompt_tokens": 12, "total_tokens": 12 }
}
Response (shape)
Note

Vectors come back in input order — index matches the position of each text in input. Cosine similarity is the intended distance measure.

Errors

Empty input, more than 2,048 items, or a dimensions value other than 768 return 400 with an OpenAI-shaped body. Full reference: Errors.