diff --git a/src/core/ai/recipes/openrouter.ts b/src/core/ai/recipes/openrouter.ts index 86782cd59..055848ac8 100644 --- a/src/core/ai/recipes/openrouter.ts +++ b/src/core/ai/recipes/openrouter.ts @@ -23,14 +23,6 @@ import type { Recipe } from '../types.ts'; * envelope, not every individual model's capability. When in doubt about a * specific model, check https://openrouter.ai/models. * - * Reranker: `/api/v1/rerank` proxies cross-encoder rerankers (Cohere v3.5/4-fast/4-pro - * and NVIDIA Nemotron VL). Wire shape matches `gateway.rerank()`: - * `{ query, documents, model }` → `{ results: [{ index, relevance_score }] }`. - * Unlike embedding/chat, the reranker path strictly enforces the `models` - * allowlist (no openai-compat bypass) — adding new rerank models requires a - * recipe edit. Cohere bills per-search; the `cost_per_1m_tokens_usd` value - * is a pseudo-rate for the budget tracker's `chars/4` heuristic. - * * Attribution: OpenRouter recommends `HTTP-Referer` (required for app * attribution) + `X-OpenRouter-Title` (preferred; `X-Title` kept as * back-compat alias per OR docs). Defaults to `https://gbrain.ai` / `gbrain`; @@ -107,30 +99,6 @@ export const openrouter: Recipe = { // Let upstream errors surface per-model. price_last_verified: '2026-05-20', }, - reranker: { - models: [ - 'cohere/rerank-v3.5', - 'cohere/rerank-4-fast', - 'cohere/rerank-4-pro', - 'nvidia/llama-nemotron-rerank-vl-1b-v2:free', - ], - default_model: 'cohere/rerank-v3.5', - // Cohere bills per-search, not per-token. This is a pseudo-per-1M rate - // for the budget tracker's heuristic (estimates tokens as chars/4). - // At ~4K chars/search the tracker estimates ~$0.00025 — in the right - // ballpark for the per-search bill. Patch budget-tracker.ts to honour a - // `cost_per_search_usd` field for exact accounting. - cost_per_1m_tokens_usd: 0.001, - price_last_verified: '2026-06-13', - // OpenRouter doesn't publish an explicit payload cap; 5MB matches - // ZeroEntropy's upstream limit and the gateway's pre-flight ceiling. - max_payload_bytes: 5_000_000, - // OR serves /rerank under /api/v1. base_url_default already ends in /v1, - // so gateway concatenates to …/api/v1/rerank. - path: '/rerank', - // OpenRouter rerank is fast (<200 ms p50); 5 s covers cold path safely. - default_timeout_ms: 5_000, - }, }, setup_hint: 'Get an API key at https://openrouter.ai/settings/keys, then `export OPENROUTER_API_KEY=...` and use `openrouter:/`. Optional overrides: OPENROUTER_BASE_URL (proxy), OPENROUTER_REFERER (attribution URL), OPENROUTER_TITLE (attribution name).', diff --git a/test/openrouter-reranker-recipe.test.ts b/test/openrouter-reranker-recipe.test.ts deleted file mode 100644 index 508b7b945..000000000 --- a/test/openrouter-reranker-recipe.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { describe, test, expect } from 'bun:test'; -import { getRecipe } from '../src/core/ai/recipes/index.ts'; - -describe('OpenRouter recipe — reranker touchpoint', () => { - test('declares a reranker touchpoint', () => { - const r = getRecipe('openrouter'); - expect(r).toBeDefined(); - expect(r!.touchpoints.reranker).toBeDefined(); - }); - - test('models list includes all supported IDs (incl. NVIDIA :free suffix)', () => { - const m = getRecipe('openrouter')!.touchpoints.reranker!.models; - expect(m).toContain('cohere/rerank-v3.5'); - expect(m).toContain('cohere/rerank-4-fast'); - expect(m).toContain('cohere/rerank-4-pro'); - // The :free suffix must appear in full — gateway.rerank() does exact - // string matching against the allowlist (no v0.31.12 extended-model bypass - // on the rerank path), so truncating to `nvidia/.../v2` would 403. - expect(m).toContain('nvidia/llama-nemotron-rerank-vl-1b-v2:free'); - }); - - test('default_model is cohere/rerank-v3.5', () => { - const tp = getRecipe('openrouter')!.touchpoints.reranker!; - expect(tp.default_model).toBe('cohere/rerank-v3.5'); - expect(tp.models).toContain(tp.default_model); - }); - - test('path is /rerank (NOT ZeroEntropy default /models/rerank)', () => { - const tp = getRecipe('openrouter')!.touchpoints.reranker!; - expect(tp.path).toBe('/rerank'); - }); - - test('max_payload_bytes and timeout match plan', () => { - const tp = getRecipe('openrouter')!.touchpoints.reranker!; - expect(tp.max_payload_bytes).toBe(5_000_000); - expect(tp.default_timeout_ms).toBe(5_000); - }); - - test('cost_per_1m_tokens_usd is set (pseudo-rate for per-search billing)', () => { - const tp = getRecipe('openrouter')!.touchpoints.reranker!; - expect(typeof tp.cost_per_1m_tokens_usd).toBe('number'); - expect(tp.cost_per_1m_tokens_usd).toBeGreaterThan(0); - }); -});