LatentKit

Embeddings

POST /v1/embeddings — create vector embeddings through the assigned route.

Request

curl https://ai.latentkit.com/v1/embeddings \
  -H "Authorization: Bearer $LATENTKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": ["hello world", "LatentKit routes by API key"],
    "dimensions": 256
  }'

Fields

FieldDescription
inputString or array of strings to embed (required)
dimensionsOptional output dimensionality when the route model supports it
encoding_formatOptional encoding format when supported (e.g. float, base64)

The route must include a model with the embeddings capability. POST /v1/embed is an alias of /v1/embeddings — both accept the same body.

Response shape

Responses carry the vectors in two equivalent forms:

  • embeddings — the native LatentKit field: number[][], one vector per input.
  • data — an OpenAI-compatible array (object: "list" at the top level): [{ "object": "embedding", "index": 0, "embedding": [...] }, ...]. An unmodified OpenAI-SDK-shaped client that reads data[i].embedding works as-is.
{
  "object": "list",
  "embeddings": [[0.01, -0.02, ...], [0.03, 0.04, ...]],
  "data": [
    { "object": "embedding", "index": 0, "embedding": [0.01, -0.02, ...] },
    { "object": "embedding", "index": 1, "embedding": [0.03, 0.04, ...] }
  ],
  "model": "text-embedding-3-small",
  "usage": { "input_tokens": 8, "output_tokens": 0, "total_tokens": 8 }
}

Older gateway versions returned only the native embeddings array. If your client read data and silently got zero vectors from a valid 200, upgrade expectations: both fields are now always present on embeddings responses.

Embed all vectors you compare with each other using the same pinned model. If the route can fail over between embedding models, vectors from different models are not comparable. Pin one embedding model in the routing policy for vector-store workloads.

SDK

const vectors = await client.embeddings.create({
  input: ['hello world'],
  dimensions: 256,
});
vectors = client.embeddings.create(
    input=["hello world"],
    dimensions=256,
)

Free plan note

Plain embeddings requests may count toward a workspace managed onboarding allowance on Free plans. After limits or without credits, add credits or use BYOK routes.

On this page