Skip to main content
Watch: Anthropic Just Hit the Brakes on Its Next AI Model

Setup guide - Documented by OpenCode

Use Mistral in OpenCode

OpenCode's providers page has no dedicated Mistral section, but it documents a Custom provider for APIs not already in its catalog, using the @opencode/ai/providers/openai-compatible package. Mistral documents its OpenAI-compatible base URL, https://api.mistral.ai/v1. Combine the two: declare the provider, MISTRAL_API_KEY and Mistral model ids in opencode.jsonc, then pick the model with /models.

Last verified 3 steps6 official sources

Steps

  1. Step 1.

    Create or update opencode.jsonc. This is the docs' OpenAI-compatible Custom example with Mistral's documented base URL and model ids filled in. The env field lists the environment variables that can provide the credential.

    JSON
    {
      "$schema": "https://opencode.ai/config.json",
      "providers": {
        "mistral-api": {
          "name": "Mistral",
          "env": ["MISTRAL_API_KEY"],
          "package": "@opencode/ai/providers/openai-compatible",
          "settings": {
            "baseURL": "https://api.mistral.ai/v1",
          },
          "models": {
            "mistral-large-4": {
              "name": "Mistral Large 4",
            },
            "codestral-latest": {
              "name": "Codestral",
            },
          },
        },
      },
    }
  2. Step 2.

    Make MISTRAL_API_KEY available to the OpenCode server process, since the env field names it as the credential source.

  3. Step 3.

    Run /models and select the model. The provider ID is the prefix in model references, for example mistral-api/mistral-large-4.

    Snippet
    /models

Caveats

  • This combines OpenCode's documented Custom provider example with the base URL from Mistral's migration guide and model ids from Mistral's Models Overview. OpenCode's docs do not show Mistral specifically.
  • The provider id mistral-api is an example name chosen here. OpenCode's docs say the providers object is keyed by the provider ID used in model references.
  • OpenCode's providers page says its catalog comes from models.dev and that a Custom provider is for APIs not already in the catalog. The page has no Mistral section, so check /connect for a built-in Mistral entry first.
  • OpenCode's docs say to use the compatible runtime for APIs that implement the OpenAI request format. Mistral documents POST /v1/chat/completions.
  • Mistral Large 4 has a 1M context window per Mistral's docs. OpenCode's model entries accept a limit field for context, input and output token limits if you want OpenCode to track context.
  • Devstral 2 (devstral-2512, devstral-latest) was retired 2026-07-31. Mistral lists Mistral Medium 3.5 as its alternative, and Medium 3.5 is itself now deprecated in favour of Mistral Large 4.
  • Mistral Medium 3.5 (mistral-medium-3-5, mistral-medium-latest) is deprecated (deprecation date 10/31/2026 on its model page). Mistral says to use Mistral Large 4 (mistral-large-4) for new integrations.

FAQ

How do I use Mistral in OpenCode?

OpenCode's providers page has no dedicated Mistral section, but it documents a Custom provider for APIs not already in its catalog, using the @opencode/ai/providers/openai-compatible package. Mistral documents its OpenAI-compatible base URL, https://api.mistral.ai/v1. Combine the two: declare the provider, MISTRAL_API_KEY and Mistral model ids in opencode.jsonc, then pick the model with /models.

Which Mistral model ids work in OpenCode?

The official docs read for this guide list mistral-large-4, mistral-large-4-0, mistral-small-2603, mistral-small-latest, codestral-2508 and codestral-latest. Requests go to https://api.mistral.ai/v1.

Is this an official Mistral and OpenCode setup?

OpenCode documents this setup in its own docs. It was last checked against 6 official pages on November 8, 2026.

Sources

Last verified against 6 official pages.

Newsletter

New models, set up the day they ship

One email per week. New model releases, the coding tools that support them and how to wire them up.