Skip to content

Add gateway.kilo.ai rewrites for LLM and indexing routes#652

Closed
iscekic wants to merge 1 commit intomainfrom
add-gateway-rewrites
Closed

Add gateway.kilo.ai rewrites for LLM and indexing routes#652
iscekic wants to merge 1 commit intomainfrom
add-gateway-rewrites

Conversation

@iscekic
Copy link
Contributor

@iscekic iscekic commented Feb 27, 2026

Summary

  • Adds beforeFiles rewrites to proxy LLM gateway and code-indexing routes to gateway.kilo.ai when KILO_GATEWAY_BACKEND is not set
  • Routes proxied: /api/openrouter/*, /api/gateway/*, /api/models/stats, /api/models/stats/*, /api/modelstats, /api/models/up, /api/defaults, /api/code-indexing/upsert-by-file
  • Follows the same pattern as the existing GLOBAL_KILO_BACKEND / global-api.kilo.ai rewrites
  • The gateway deployment itself should have KILO_GATEWAY_BACKEND=true set so it serves these routes locally

Notes

  • This PR should be merged after the gateway Vercel project is created and the deploy job PR (Add deploy-gateway job to production workflow #651) is merged, so traffic doesn't route to a nonexistent backend
  • FIM completions stays on global-api.kilo.ai — unchanged

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.
@iscekic iscekic self-assigned this Feb 27, 2026
@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Feb 27, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Notes

  • The new gatewayApiRewrites block correctly follows the same pattern as the existing globalApiRewrites — conditional on KILO_GATEWAY_BACKEND !== 'true', using beforeFiles to proxy before local filesystem routes.
  • All 8 proxied routes (/api/openrouter/*, /api/gateway/*, /api/models/stats, /api/models/stats/*, /api/modelstats, /api/models/up, /api/defaults, /api/code-indexing/upsert-by-file) have corresponding local API route handlers that will serve traffic when KILO_GATEWAY_BACKEND=true.
  • Route ordering is correct: exact /api/models/stats match is listed before the /api/models/stats/:path* wildcard.
Files Reviewed (1 file)
  • next.config.mjs - 0 issues

@iscekic iscekic closed this Mar 3, 2026
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