Embeddings
POST /v1/embeddings
Request body
| Parameter | Type | Description |
|---|---|---|
model |
string | Embedding model. Use bge-m3. Required |
input |
string or array | Text to embed. String or array of strings. Required |
encoding_format |
string | Output format: float (default) or base64. |
Example request
import os
from openai import OpenAI
client = OpenAI(
base_url="https://router.appelon.ai/v1",
api_key=os.environ["APPELON_API_KEY"]
)
response = client.embeddings.create(
model="bge-m3",
input="This is a sample text to embed."
)
embedding = response.data[0].embedding
print(f"Dimensions: {len(embedding)}")
# → Dimensions: 1024
Response
Returns an array of embedding objects, one for each input text.
{
"object": "list",
"model": "bge-m3",
"data": [{
"object": "embedding",
"index": 0,
"embedding": [-0.023, 0.017, 0.042, ...]
}],
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}
Batch embeddings
Embed multiple texts in a single request for better efficiency.
response = client.embeddings.create(
model="bge-m3",
input=[
"First document to embed",
"Second document to embed",
"Third document to embed"
]
)
# Returns 3 embeddings in response.data
Common use cases
- Semantic search: Embed documents and queries, then find similar documents using cosine similarity.
- RAG: Retrieve relevant context before generating responses with chat models.
- Clustering & classification: Group similar documents or classify content based on embedding similarity.
BGE-M3 produces 1024-dimensional vectors optimized for multilingual retrieval. It supports 100+ languages including Dutch, English, German, and French.