feat(fim): add Mercury Edit FIM support with provider-based routing#1693
Conversation
Code Review SummaryStatus: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)Resolved since last review: the previous No new issues were found on lines that appear in the latest incremental diff ( Fix these issues in Kilo Cloud Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments: CRITICAL
WARNING
Files Reviewed (1 file)
Reviewed by gpt-5.4-20260305 · 324,065 tokens |
| { status: 400 } | ||
| ); | ||
| //NOTE: mistral does not do data collection on paid org accounts like ours. | ||
| //If we ever support OTHER providers, we need to either ensure they don't |
There was a problem hiding this comment.
Is this note relevant?
There was a problem hiding this comment.
Do we just remove it and collect now?
There was a problem hiding this comment.
inception doesn't do collection either
There was a problem hiding this comment.
there are real a gaps, we don't enforce the provider blocklist for example, but that's not a regression
| // Extract properties for usage context | ||
| const promptInfo = extractFimPromptInfo(requestBody); | ||
|
|
||
| const byokProviderKey = fimProvider === 'mistral' ? 'codestral' : 'inception'; |
There was a problem hiding this comment.
why not just make the fim provider be codestral in the first place?
There was a problem hiding this comment.
it's called mistral everywhere, but this hack is needed for the "not all API keys support all models" feature that mistral has.
Summary
Add Mercury Edit FIM model support alongside existing Codestral models. Implements provider-based routing (model name → provider) instead of a non-standard provider field. The changes include:
INCEPTION_API_KEYenvironment variable for Inception Labs API authenticationproviderfield from FIM request schema; routing is now inferred from model nameresolveFimProvider()function to map model names to providers (mistral/inception) and upstream URLsVerification
src/lib/config.server.ts,src/app/api/fim/completions/route.ts,src/lib/llm-proxy-helpers.tsVisual Changes
N/A
Reviewer Notes
inception/mercury-editmodel name is normalized tomercury-editwhen sent upstream to Inception APImistralai/codestral-2501→codestral-2501)fim.time_to_first_token_msinstead ofmistral.time_to_first_token_ms)