Skip to content

Using Mistral with OpenCode #55

Description

@subbiemetrics

I am using Mistral Medium 3.5 with OpenCode for your AI Coding Crash Course

Host: api.mistral.ai
Wire Format: REST API (JSON over HTTPS)
Command:

curl -X POST https://api.mistral.ai/v1/chat/completions \
  -H "Authorization: Bearer $MISTRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "mistral-medium-3.5", "messages": [{"role": "user", "content": "Your prompt here"}]}'

OpenCode supports any OpenAI-compatible endpoint, and Mistral Medium 3.5 is fully OpenAI-compatible. This means you can use the Mistral API endpoint (https://api.mistral.ai/v1/chat/completions) and model ID (mistral-medium-3.5) directly in OpenCode by configuring it as a custom OpenAI-compatible provider. The wire format is REST API (JSON over HTTPS), and authentication is via a Bearer token in the Authorization header.

In OpenCode, you would typically add a custom provider with:

Base URL: https://api.mistral.ai/v1
Model: mistral-medium-3.5
API Key: Your Mistral API key

This setup is confirmed to work by the OpenCode community and documentation

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions