Gateway API
Embeddings
OpenAI-compatible embeddings through the Gateway, metered on input tokens and returned with the same receipt headers as chat.
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 totext-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.clientis read as the client tag. See Clients.
Models
| Model | Name | Dimensions | Notes |
|---|---|---|---|
| text-embedding-3-small | Text Embedding 3 Small | 1536 | Default. auto maps here. |
| text-embedding-3-large | Text Embedding 3 Large | 3072 | — |
Embeddings run on OpenAI models only for now. GET /models lists them after the chat models, with capabilities: ["embedding"]. The legacy type: "embedding" field remains for compatibility; clients should classify entries from capabilities.
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"]
}'