Skip to content

Gateway

Embeddings

OpenAI-compatible embeddings through the Gateway, metered on input tokens and returned with the same receipt headers as chat.

POSThttps://www.lobstack.ai/api/gateway/v1/embeddings

Authenticate with a Lobstack API key as a bearer token, as for Chat Completions. The OpenAI SDK's embeddings.create works unchanged against the same base URL.


Request body

inputstring | string[]required
The text to embed: one string, or an array of up to 2,048 strings. Empty strings and token arrays are refused.
modelstringdefault: "text-embedding-3-small"
An embedding model from the table below. "auto" maps to text-embedding-3-small. A chat model is a 400.
dimensionsinteger
Shortens the vector. A positive integer, at most the model's own length.
encoding_formatstring
"float" or "base64".
userstring
Forwarded to OpenAI.
metadataobject
Not sent to the provider. metadata.client is read as the client tag. See Clients.

Models

ModelNameDimensionsNotes
text-embedding-3-smallText Embedding 3 Small1536Default. auto maps here.
text-embedding-3-largeText Embedding 3 Large3072—

Embeddings run on OpenAI models only for now. GET /models lists them after the chat models, with type: "embedding".

No routing hereauto is a fixed mapping to the small model. The complexity router described on Nex applies to chat only.

Metering

An embeddings call is metered on its input tokens and carries the same x-lobstack-* receipt headers as a chat call. Metering & cost lists them. The rate limit, the allowance and client budgets apply as they do to chat, and errors have the same shape. See Errors & retries.


Examples

curl -i https://www.lobstack.ai/api/gateway/v1/embeddings \
  -H "Authorization: Bearer $LOBSTACK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": ["Why did the deploy roll back?", "Rollback causes"]
  }'
Lobstack

An AI team that asks before it acts, and an API with a receipt on every call.

© LobstackXLinkedInGitHub