Embeddings
Generate vector embeddings using OpenAI-compatible embedding models.
Embeddings
LLMGateway exposes an OpenAI-compatible /v1/embeddings endpoint for generating vector representations of text — useful for semantic search, clustering, recommendations, and RAG.
Browse available embedding models on the models page.
Supported providers
- OpenAI —
text-embedding-3-small,text-embedding-3-large,text-embedding-ada-002 - Google AI Studio —
gemini-embedding-2(recommended),gemini-embedding-001(legacy)
The gateway translates between provider-native request/response shapes (e.g. Google's :embedContent / :batchEmbedContents) and the OpenAI-compatible payload, so you can swap models without changing your client code.
cURL
curl -X POST "https://api.llmgateway.io/v1/embeddings" \
-H "Authorization: Bearer $LLM_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-small",
"input": "The quick brown fox jumps over the lazy dog."
}'OpenAI JS SDK
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.LLM_GATEWAY_API_KEY,
baseURL: "https://api.llmgateway.io/v1",
});
const response = await client.embeddings.create({
model: "text-embedding-3-small",
input: "The quick brown fox jumps over the lazy dog.",
});
console.log(response.data[0].embedding);Embedding models are billed only for input tokens. There are no output tokens since embeddings are fixed-size vectors.
How is this guide?
Last updated on