Skip to content

fix(gui): correct the Codestral API key note in the Add Model form - #13124

Open
WhoamiI00 wants to merge 1 commit into
continuedev:mainfrom
WhoamiI00:13049-codestral-api-key-note
Open

fix(gui): correct the Codestral API key note in the Add Model form#13124
WhoamiI00 wants to merge 1 commit into
continuedev:mainfrom
WhoamiI00:13049-codestral-api-key-note

Conversation

@WhoamiI00

Copy link
Copy Markdown

Description

Fixes #13049.

The Add Model form shows this note whenever the selected model starts with codestral:

Note that codestral requires a different API key from other Mistral models

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:

private async autodetectApiKeyType(): Promise<MistralApiKeyType> {
  const mistralResp = await fetch("https://api.mistral.ai/v1/models", { ... });
  if (mistralResp.status === 401) {
    return "codestral";
  }
  return "mistral";
}

and then rewrites apiBase to either codestral.mistral.ai/v1/ or api.mistral.ai/v1/. That branch runs whenever no explicit apiBase was configured — which is exactly the case for a model added through this form, since models.codestral in gui/src/pages/AddNewModel/configs/models.ts sets only title, model and contextLength.

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-keys and / 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 to https://console.mistral.ai/codestral for codestral models
  • gui/src/pages/AddNewModel/configs/providers.ts:418,446 — same URL in the Mistral provider's longDescription and apiKeyUrl

Unrelated observation

While reading Mistral.ts I noticed autodetectApiKeyType() is called fire-and-forget in the constructor (.then(...) with an empty .catch(() => {})). The constructor returns with apiBase still set to codestral.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

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created — none describe this note
  • The relevant tests, if any, have been updated or created — see below

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:

Codestral API key
Note that codestral requires a different API key from other Mistral models

After:

Codestral API key
Codestral accepts either a Mistral API key or a Codestral-specific key. Continue detects which one you've entered and uses the matching endpoint.

Tests

No tests added: this changes static copy inside a conditional that has no existing test coverage (there is no AddModelForm test file, and no test file for Mistral.ts), and asserting on exact wording would be brittle. The full gui suite still passes — 38 files / 376 tests — with tsc --noEmit and Prettier clean.

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
@WhoamiI00
WhoamiI00 requested a review from a team as a code owner August 12, 2026 08:30
@WhoamiI00
WhoamiI00 requested review from sestinj and removed request for a team August 12, 2026 08:30
@github-actions

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


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.

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.

Deprecated warning "Note that codestral requires a different API key from other Mistral models"

1 participant