Skip to content

OpenAI embedder

The default embedder, calling the OpenAI embeddings API. Selected via EMBEDDING_PROVIDER=openai.

Enable it

bash
EMBEDDING_PROVIDER=openai
OPENAI_API_KEY=sk-...
OPENAI_EMBEDDING_MODEL=text-embedding-3-small
EMBEDDING_DIMS=1536

Configuration

VariableDefaultDescription
EMBEDDING_PROVIDERopenaiSet to openai.
OPENAI_API_KEYnoneBearer token for the embeddings API. Calls fail at runtime if unset.
OPENAI_EMBEDDING_MODELtext-embedding-3-smallEmbedding model to call.
EMBEDDING_DIMS1536Vector dimension; must match the embedding model.

Notes

  • Requests hit https://api.openai.com/v1/embeddings over httpx with a 30 second timeout.
  • Transient failures (429 rate limit, 5xx, network, timeout) are retried up to four times with exponential backoff so a burst does not hard fail an add or search.
  • A hard insufficient_quota 429 is not retried and fails fast; any final failure raises so callers surface a clean 503.
  • Token usage is recorded per call for cost attribution.

The memory layer for AI agents.