Nebius Embedder
Generate embeddings with an active Nebius model through its OpenAI-compatible API.
Select an active embedding model from the Nebius List Models API and set its output dimensions.
import os
from agno.knowledge.embedder.nebius import NebiusEmbedder
embedder = NebiusEmbedder(
id=os.environ["NEBIUS_EMBEDDING_MODEL"],
dimensions=int(os.environ["NEBIUS_EMBEDDING_DIMENSIONS"]),
)
embedding = embedder.get_embedding(
"The quick brown fox jumps over the lazy dog."
)
print(f"First values: {embedding[:5]}")
print(f"Dimensions: {len(embedding)}")The SDK defaults to BAAI/bge-en-icl. Confirm model availability for your account instead of relying on that default, and override both id and dimensions when selecting another model.
Run the Example
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateExport the API key and model settings
export NEBIUS_API_KEY=your_nebius_api_key_here
export NEBIUS_EMBEDDING_MODEL=your_active_embedding_model
export NEBIUS_EMBEDDING_DIMENSIONS=your_model_output_dimensionsInstall dependencies
uv pip install -U agno openaiRun the example
python nebius_embedder.py