[GH-ISSUE #5150] [Engine] OpenAI /v1/embeddings (and optional /v1/rerank) backed by a sidecar embedding model #3061

Open
opened 2026-11-07 14:37:44 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @iraptor93 on GitHub (Nov 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5150

Area

[Engine] (speed, kernels, models, the server and API)

What do you want to do?

Serve an embedding model (and optionally a reranker) next to the chat model, through Strata's own server: POST /v1/embeddings in OpenAI's shape (input string or array, model, encoding_format, dimensions optional), and optionally POST /v1/rerank (the Jina/Cohere shape that llama.cpp and vLLM also use).

Why: local coding agents and note tools increasingly do RAG (code search, Obsidian plugins, Open WebUI, custom MCP search servers). They all expect an OpenAI-compatible embeddings endpoint. Today a Strata box needs a second server, a second port and a second API key for this, and that second process knows nothing about Strata's GPU placement.

Suggested shape, similar to the existing "images" / "vision" sections:

"embeddings": {
  "exe": "llama-server",            // or a bundled component
  "model": "Qwen3-Embedding-0.6B-Q8_0.gguf",
  "pooling": "last",
  "device": "cpu" | <cuda index>,   // e.g. a small spare card or the CPU
  "ctx": 8192,
  "reranker": "Qwen3-Reranker-0.6B-Q8_0.gguf"   // optional
}

Points that matter:

  • Not behind the chat FIFO. An embedding request is small and frequent (indexing sends thousands). It should not wait behind a long generation, and it should not stall one. When it runs on the CPU or another GPU, it doesn't need the service's turn.
  • Device choice. Many multi-GPU users have a small leftover card (in my case an RTX A2000 6 GB that is too small for a layer split and slower as a helper). That is a good home for embeddings, vision and image jobs. CPU should also be an option: with a high expert-cache hit rate, the CPU pool is mostly idle during decode.
  • Listed in /v1/models with its own id, same api_key and cors_origins as the rest of /v1/*.
  • Start and stop together with the server (lazy or eager like images.reload).

This is related to the closed #3260 / #2820 (llama.cpp /embedding among other routes). This request is only about the OpenAI /v1/embeddings route backed by a separate embedding model, which is what RAG clients actually call.

What do you do today instead?

A separate llama-server --embedding --pooling last with Qwen3-Embedding-0.6B on port 8082, started by my own script next to Strata. Clients get two base URLs and two keys. I considered a local proxy branch in serve/server.py (forward /v1/embeddings to the sidecar before the FIFO), but a local patch must be reapplied on every update.

System

  • Strata v0.2.10 (engine 0.1.56), built from source with CUDA 13.0 (sm_75 + sm_86)
  • GPUs: Tesla T10 16 GB (main) + RTX 3060 12 GB (helper, layer split); RTX A2000 6 GB spare
  • RAM: 100 GB (VM, 2 NUMA nodes), 2x Xeon E5-2640 v4
  • OS: Oracle Linux 10.2 (Proxmox VM, GPU passthrough)
  • Model: Qwen3.8-Flash-Next IQ3_XXS (qwen35moe)
Originally created by @iraptor93 on GitHub (Nov 3, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5150 ### Area [Engine] (speed, kernels, models, the server and API) ### What do you want to do? Serve an embedding model (and optionally a reranker) next to the chat model, through Strata's own server: `POST /v1/embeddings` in OpenAI's shape (`input` string or array, `model`, `encoding_format`, `dimensions` optional), and optionally `POST /v1/rerank` (the Jina/Cohere shape that llama.cpp and vLLM also use). Why: local coding agents and note tools increasingly do RAG (code search, Obsidian plugins, Open WebUI, custom MCP search servers). They all expect an OpenAI-compatible embeddings endpoint. Today a Strata box needs a second server, a second port and a second API key for this, and that second process knows nothing about Strata's GPU placement. Suggested shape, similar to the existing `"images"` / `"vision"` sections: ```jsonc "embeddings": { "exe": "llama-server", // or a bundled component "model": "Qwen3-Embedding-0.6B-Q8_0.gguf", "pooling": "last", "device": "cpu" | <cuda index>, // e.g. a small spare card or the CPU "ctx": 8192, "reranker": "Qwen3-Reranker-0.6B-Q8_0.gguf" // optional } ``` Points that matter: - **Not behind the chat FIFO.** An embedding request is small and frequent (indexing sends thousands). It should not wait behind a long generation, and it should not stall one. When it runs on the CPU or another GPU, it doesn't need the service's turn. - **Device choice.** Many multi-GPU users have a small leftover card (in my case an RTX A2000 6 GB that is too small for a layer split and slower as a helper). That is a good home for embeddings, vision and image jobs. CPU should also be an option: with a high expert-cache hit rate, the CPU pool is mostly idle during decode. - Listed in `/v1/models` with its own id, same `api_key` and `cors_origins` as the rest of `/v1/*`. - Start and stop together with the server (lazy or eager like `images.reload`). This is related to the closed #3260 / #2820 (llama.cpp `/embedding` among other routes). This request is only about the OpenAI `/v1/embeddings` route backed by a separate embedding model, which is what RAG clients actually call. ### What do you do today instead? A separate `llama-server --embedding --pooling last` with Qwen3-Embedding-0.6B on port 8082, started by my own script next to Strata. Clients get two base URLs and two keys. I considered a local proxy branch in `serve/server.py` (forward `/v1/embeddings` to the sidecar before the FIFO), but a local patch must be reapplied on every update. ### System - Strata v0.2.10 (engine 0.1.56), built from source with CUDA 13.0 (sm_75 + sm_86) - GPUs: Tesla T10 16 GB (main) + RTX 3060 12 GB (helper, layer split); RTX A2000 6 GB spare - RAM: 100 GB (VM, 2 NUMA nodes), 2x Xeon E5-2640 v4 - OS: Oracle Linux 10.2 (Proxmox VM, GPU passthrough) - Model: Qwen3.8-Flash-Next IQ3_XXS (qwen35moe)
Author
Owner

@tam-wh commented on GitHub (Nov 4, 2026):

this would also helps to manage the vram. Currently, I'm running everything on llama-swap but vram is wasted because embedding model is usually unloaded when idle. would be good to use those vram for experts.

<!-- gh-comment-id:6622724518 --> @tam-wh commented on GitHub (Nov 4, 2026): this would also helps to manage the vram. Currently, I'm running everything on llama-swap but vram is wasted because embedding model is usually unloaded when idle. would be good to use those vram for experts.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3061
No description provided.