Documentation · Embeddings

API

Embeddings

Text vectors for search, RAG and recommendations — OpenAI and Google models in the OpenAI format.

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))
ParameterTypeDescription
model*stringThe embedding model.
input*string | string[]A text or an array of texts — up to 2048 per request.
dimensionsintegerShorten the vector (text-embedding-3-*): less storage, slightly lower accuracy.
encoding_formatstringfloat (default) or base64.

Response#

200 OK
{
  "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#

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.