fix(gui): correct the Codestral API key note in the Add Model form - #13124
Open
WhoamiI00 wants to merge 1 commit into
Open
fix(gui): correct the Codestral API key note in the Add Model form#13124WhoamiI00 wants to merge 1 commit into
WhoamiI00 wants to merge 1 commit into
Conversation
The Add Model form told users that Codestral "requires a different API key from other Mistral models". That is not what Continue actually does: the Mistral provider autodetects which kind of key it was given and picks the matching endpoint. `autodetectApiKeyType` probes api.mistral.ai/v1/models with the supplied key - a 401 means it is a Codestral key, anything else means it is a Plateforme key - and rewrites apiBase accordingly. That path runs whenever no explicit apiBase is set, which is exactly the case for models added through this form: `models.codestral` sets only title, model and contextLength. So a standard Mistral key does work, as reported. Reword the note to describe the real behaviour rather than asserting a requirement that is not enforced. Fixes continuedev#13049
Contributor
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #13049.
The Add Model form shows this note whenever the selected model starts with
codestral:That claim doesn't match what Continue does. The Mistral provider autodetects which kind of key it was given and selects the endpoint to match —
core/llm/llms/Mistral.ts:and then rewrites
apiBaseto eithercodestral.mistral.ai/v1/orapi.mistral.ai/v1/. That branch runs whenever no explicitapiBasewas configured — which is exactly the case for a model added through this form, sincemodels.codestralingui/src/pages/AddNewModel/configs/models.tssets onlytitle,modelandcontextLength.So a standard Mistral key does work for Codestral, which is what the reporter observed. This PR rewords the note to describe the actual behaviour instead of asserting a requirement that isn't enforced.
What I verified, and what I didn't
Verified in this repo: the autodetect path above, and that the form-created config carries no
apiBase, so that path is reached.Not verified: whether Mistral still issues a separate Codestral key at all. The reporter mentions the "Codestral" section is gone from
console.mistral.ai, but that console is behind auth (/codestral,/api-keysand/all 303 to the login flow identically), so I couldn't confirm it either way. I've therefore kept the note and corrected it, rather than deleting it or asserting that Mistral changed their policy. Happy to just remove the block instead if you'd prefer.Two related spots that still assume a dedicated Codestral key, left alone here to keep the diff focused — tell me if you'd like them in scope:
AddModelForm.tsx:30,105-108— the API-key link switches tohttps://console.mistral.ai/codestralfor codestral modelsgui/src/pages/AddNewModel/configs/providers.ts:418,446— same URL in the Mistral provider'slongDescriptionandapiKeyUrlUnrelated observation
While reading
Mistral.tsI noticedautodetectApiKeyType()is called fire-and-forget in the constructor (.then(...)with an empty.catch(() => {})). The constructor returns withapiBasestill set tocodestral.mistral.ai/v1/, so a request issued before the probe resolves can go to the wrong endpoint. Not touched here since it's a separate concern — happy to open an issue if that's useful.Checklist
Screen recording or screenshot
Copy-only change inside the existing
Alert; no layout or behaviour change. The note renders in Add Chat model → provider Mistral → model Codestral, immediately above the API key field.Before:
After:
Tests
No tests added: this changes static copy inside a conditional that has no existing test coverage (there is no
AddModelFormtest file, and no test file forMistral.ts), and asserting on exact wording would be brittle. The fullguisuite still passes — 38 files / 376 tests — withtsc --noEmitand Prettier clean.