POST/v1/embeddings
An embedding is a vector of numbers that captures what a text means: texts with similar meaning get nearby vectors. Semantic search, RAG, recommendations and clustering are built on them.
Request#
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.flua.ink/v1", api_key=os.environ["FLUA_API_KEY"])
result = client.embeddings.create(model="text-embedding-3-small", input="Swifts spend almost their whole life in flight")
print(len(result.data[0].embedding))| Parameter | Type | Description |
|---|---|---|
model* | string | The embedding model. |
input* | string | string[] | A text or an array of texts — up to 2048 per request. |
dimensions | integer | Shorten the vector (text-embedding-3-*): less storage, slightly lower accuracy. |
encoding_format | string | float (default) or base64. |
Response#
{
"object": "list",
"model": "text-embedding-3-small",
"data": [
{ "object": "embedding", "index": 0, "embedding": [0.0123, -0.0456, …] }
],
"usage": { "prompt_tokens": 9, "total_tokens": 9 }
}Models#
- Text Embedding 3 Large —
text-embedding-3-large - Text Embedding 3 Small —
text-embedding-3-small - Text Embedding Ada 002 —
text-embedding-ada-002 - Gemini Embedding 2 Preview —
gemini-embedding-2-preview
Embeddings are billed for input tokens only. Vectors of different models are not compatible: switch models and you must re-embed everything — which is why fallback models never apply to embeddings.