# Embeddings The `search_*` collection tools turn documents (at index-build time) and queries (at serve time) into vectors. Choose the backend with `ONETICK_DB_EMBEDDING_TYPE` — see `Embeddings` for the full variable reference. 1. `Local (offline) embeddings` — a local `sentence-transformer` model loaded in-process. No API key, and no network calls once the model is cached; supports fully air-gapped deployments. 2. `OpenAI-compatible server` — the public OpenAI API, or a self-hosted server that speaks the OpenAI API (Ollama, vLLM, LiteLLM, an internal gateway). Both keep document and query text inside your network when self-hosted. The difference is whether the model runs in-process (local) or is called over HTTP (OpenAI-compatible). Whichever model you index with, `ONETICK_DB_EMBEDDING_MODEL` (and `ONETICK_DB_EMBEDDING_TYPE`) must be set to the same value when serving — the server embeds queries with that same model at search time, and a mismatch against the vectors already in the index produces meaningless search results. See `Embedding costs` for what OpenAI and OpenAI-compatible embeddings cost, both to build the index and per query at serve time. ## Re-index after changing the model Changing `ONETICK_DB_EMBEDDING_TYPE` or `ONETICK_DB_EMBEDDING_MODEL` requires both a server restart and a rebuild of the search index — see `Rebuilding the search index`. The server and the index must use the same embedding model, otherwise search will not work.