Skip to content

Proxy Brain reranking through OpenRouter - #1370

Merged
mrubens merged 5 commits into
developfrom
codex/openrouter-brain-reranker
Aug 15, 2026
Merged

Proxy Brain reranking through OpenRouter#1370
mrubens merged 5 commits into
developfrom
codex/openrouter-brain-reranker

Conversation

@mrubens

@mrubens mrubens commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

What changed

  • allow the Brain gateway to proxy OpenRouter's rerank endpoint
  • default gbrain to openrouter:voyageai/rerank-2.5-lite
  • let self-hosters select another OpenRouter reranker with R_BRAIN_RERANKER_MODEL
  • derive reranker credentials from the existing Brain gateway URL and token after Brain initialization
  • enable the reranker consistently across Compose, Coolify, Railway, and Render deployments
  • document the default, override, and OpenRouter requirement

Why

The Brain's tokenmax search mode enables reranking and autocut, but the default reranker had no usable provider credentials. gbrain therefore failed open and returned the full unreranked result set, reducing retrieval precision.

The real OpenRouter key remains in Roomote. gbrain receives only the existing deployment gateway token, and the API resolves the configured provider key per request.

Behavior

Deployments configured with OpenRouter get cross-encoder reranking. Deployments with only OpenAI configured receive an explicit capability error and retain gbrain's fail-open search behavior.

Validation

  • focused Brain inference gateway tests
  • API typecheck and oxlint
  • deployment artifact validation for all supported deployment shapes
  • gbrain entrypoint shell syntax check
  • full Roomote pre-push checks

@roomote-community

roomote-community Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

No code issues found. See task

  • .docker/gbrain/entrypoint.sh:229 Appending /v1 to every GBRAIN_OPENAI_BASE_URL breaks explicit OpenAI-compatible base URL overrides that already include the version segment, so reranking fails open.
  • deploy/railway/template.yaml:146, render.yaml:165 Clearing R_BRAIN_RERANKER_MODEL passes an empty reranker setting instead of restoring the documented default.

Reviewed 5944fba

Comment thread .docker/gbrain/entrypoint.sh Outdated
Comment thread deploy/railway/template.yaml
@mrubens
mrubens marked this pull request as ready for review August 15, 2026 17:36
@mrubens
mrubens merged commit 4187b71 into develop Aug 15, 2026
18 checks passed
@mrubens
mrubens deleted the codex/openrouter-brain-reranker branch August 15, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant