Generate text embeddings through the Lightweight API gateway using the OpenAI-compatible endpoint.
Generate vector representations of text using the OpenAI-compatible embeddings endpoint. The same API key you use for chat and responses works for embeddings.
The embeddings endpoint uses the same API key and authentication as all other gateway endpoints. No additional configuration is required.
text-embedding-3-small is recommended for new projects. It supports configurable output dimensions for smaller, faster vectors. text-embedding-ada-002 is a legacy model.
Text to embed. Single string or array of strings (max 2,048 items per batch). Also accepts number[] (pre-tokenized) and number[][] (batch pre-tokenized).
dimensions
integer
No
Output dimensions (only for text-embedding-3-small, range 1-1536)
curl -s -X POST https://api.lightweight.one/v1/embeddings \ -H "Authorization: Bearer $LIGHTWEIGHT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "text-embedding-3-small", "input": "The quick brown fox jumps over the lazy dog" }'
For testing, use the preview gateway at https://preview.api.lightweight.one. Replace the base URL in your requests to route through the preview environment.