feat(provider): add FastRouter as an AI provider#7969
Conversation
Code Review SummaryStatus: 1 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)No active issues remain on commentable diff lines in the current review. One warning was found on an unchanged line inside a touched file, so it is listed below instead of as an inline comment. Fix these issues in Kilo Cloud Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (18 files)
Reviewed by gpt-5.4-20260305 · 2,012,029 tokens |
|
there was a new provider integration in the main branch, there were merge conflicts coming up here, so i have updated the current branch for resolving the same |
|
@chrarnoldus @marius-kilocode anything else i need to do from my end to move the process forward?, here i see awaiting workflow approval, want to make sure nothing is left from my end. |
|
@chrarnoldus it seems like there is something related to apertis merge recently that is breaking the workflow, this is something i need to fix here? |
|
Line 196 - models.ts |
|
@chrarnoldus @marius-kilocode made the fixes, ran bun turbo typecheck and bun turbo test, everything is passing, can we do the review again please |
|
@chrarnoldus @marius-kilocode can we start the workflows on this now before some other merge in the main repository creates conflicts here, i do apologise for multiple such requests. |
| } | ||
| const priorFr = providers["fastrouter"] | ||
| const snapshotModels = priorFr?.models && Object.keys(priorFr.models).length > 0 ? priorFr.models : {} | ||
| let frModels = await ModelCache.fetch("fastrouter").catch(() => ({})) |
There was a problem hiding this comment.
WARNING: FastRouter models are fetched even when the provider is disabled
ModelsDev.get() already skips Kilo's dynamic fetch when enabled_providers excludes it or disabled_providers contains it, but this block still always awaits ModelCache.fetch("fastrouter"). That means CLI/TUI startup can still spend up to the FastRouter timeout on a provider the user explicitly disabled or never enabled. Please gate this fetch behind the same provider-allowed check so disabled providers don't add avoidable startup latency.
|
@marius-kilocode @chrarnoldus can we rerun this workflow please |
|
@marius-kilocode @chrarnoldus the only check failing was opencode annotations, can we please run this flow again and check whether my changes has anything to do with this workflow failure or these are upstream changes. |
|
@marius-kilocode @chrarnoldus the only check failing was pretty change, i have fixed this in my local and verified other tests as well. can we run the worflows again, apologies for inconvenience caused. |
|
@chrarnoldus @marius-kilocode all workflows passed, can we begin with the review and integration |
f454278 to
83d19bb
Compare
|
@chrarnoldus @marius-kilocode handled the merge conflicts, ran the tests in local on CLI and using api call, also confirmed with bun turbo typecheck, can we please start the workflows for the same |
Add FastRouter as a new AI provider with dynamic model fetching, API key auth, and smart routing support. Made-with: Cursor
83d19bb to
38b92c4
Compare
|
@chrarnoldus @marius-kilocode can we run the workflows again, but one thing - "bun turbo test" is failing on main branch as well, can you please take that into consideration |
|
@chrarnoldus @marius-kilocode seeing the same failure with the main branch, is there something i am missing here? |
|
Thank you for this contribution! Adding a new provider integration is a big task, and we really appreciate you taking the time to build out FastRouter support. Community contributions like this are what keep the project growing. Before going further, I want to share an alternative path that's usually a better fit for new providers. The plugin path (recommended). Ship the integration as an OpenCode plugin, a standalone npm package users install via "plugin": ["your-pkg@latest"] in opencode.json. Otherwise, to help us get this merged and ensure the integration is well-supported moving forward, please review and complete the following checklist:
Next Steps: Once you've checked off these items and linked the Kilo Gateway PR, leave a comment here so we know it's ready for a final review. If you get stuck or have any questions, just let us know - we are happy to help! |
the master branch has seen a lot of changes during this time, will do a fresh work considering your comments |
|
@johnnyeric #10207, this is the new PR with the suggested changes thank you |
|
closing this PR now |
|
opened another PR for the same - #10207 |
Summary
This PR adds support for FastRouter as an AI provider. This allows Kilo Code users to utilize FastRouter's unified routing to 500+ models via a single API key and endpoint.
Scope
New Feature: Integration of a new AI provider.
Changes
Provider Logic: Implemented FastRouter in packages/opencode/src/core/providers/fastrouter.ts.
Hardcoded base URL: https://go.fastrouter.ai/api/v1.
Implemented as an OpenAI-compatible provider to support native streaming and tool-calling.
Dynamic Model Fetching: Updated packages/opencode/src/shared/models.ts to include an API fetch that dynamically retrieves the latest supported models from FastRouter, ensuring the model list stays current without manual updates.
Configuration Schema: Updated packages/opencode/src/shared/providers.ts to register FastRouter and define the required FASTROUTER_API_KEY credential field.
Documentation: Created new documentation file at packages/kilo-docs/pages/ai-providers/fastrouter.md detailing setup and usage.
Verification & Testing
I have conducted end-to-end testing in a local environment:
CLI Testing: Successfully initialized sessions and performed agentic coding tasks using kilo.
Server Testing: Ran kilo serve locally; verified that the background server correctly routes requests to FastRouter and handles SSE (Server-Sent Events) for streaming.
Style Compliance: Followed the project's signature style (Bun runtime, TypeScript, early-return patterns, and no any types).