From c3908499cfb72d0f8407fe609e736d7ecf974532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20=C5=A0=C4=87eki=C4=87?= Date: Fri, 27 Feb 2026 15:54:45 +0100 Subject: [PATCH] Add gateway.kilo.ai rewrites for LLM and indexing routes Proxy LLM gateway routes (/api/openrouter, /api/gateway, /api/models/*, /api/defaults, /api/modelstats) and code-indexing upsert-by-file to gateway.kilo.ai when KILO_GATEWAY_BACKEND is not set, following the same pattern used for global-api.kilo.ai. --- next.config.mjs | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/next.config.mjs b/next.config.mjs index bfd324ad7..a2bd35397 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -43,8 +43,37 @@ const nextConfig = { ] : []; + const gatewayApiRewrites = + process.env.KILO_GATEWAY_BACKEND !== 'true' + ? [ + { + source: '/api/openrouter/:path*', + destination: 'https://gateway.kilo.ai/api/openrouter/:path*', + }, + { + source: '/api/gateway/:path*', + destination: 'https://gateway.kilo.ai/api/gateway/:path*', + }, + { + source: '/api/models/stats', + destination: 'https://gateway.kilo.ai/api/models/stats', + }, + { + source: '/api/models/stats/:path*', + destination: 'https://gateway.kilo.ai/api/models/stats/:path*', + }, + { source: '/api/modelstats', destination: 'https://gateway.kilo.ai/api/modelstats' }, + { source: '/api/models/up', destination: 'https://gateway.kilo.ai/api/models/up' }, + { source: '/api/defaults', destination: 'https://gateway.kilo.ai/api/defaults' }, + { + source: '/api/code-indexing/upsert-by-file', + destination: 'https://gateway.kilo.ai/api/code-indexing/upsert-by-file', + }, + ] + : []; + return { - beforeFiles: globalApiRewrites, + beforeFiles: [...globalApiRewrites, ...gatewayApiRewrites], afterFiles: [ { source: '/config.json',