How to run Codestral locally for offline coding assistance

Codestral is Mistral AI's code-specialised model with support for 80+ programming languages. This guide covers running it locally via Ollama for fast, offline coding assistance.

Why Codestral for local coding

Codestral is trained specifically for code tasks — completion, debugging, and explanation — across 80+ programming languages including Python, JavaScript, TypeScript, Rust, Go, and C++. It outperforms general-purpose models of similar size on coding benchmarks.

Running it locally means zero latencyLatencyThe delay between sending a request to an LLM and receiving the first token of the response, often measured as Time to First Token (TTFT).Learn more → after the first tokenTokenThe basic unit of text that an LLM processes — roughly corresponding to a word or word-piece. Models read input and produce output in tokens, which is also how API usage is measured and billed.Learn more →, no internet required, and no API costs. This makes it excellent as an IDE completion backend where low latency is critical.

Install and run with Ollama

Ensure Ollama is installed (see the Ollama guide). Then run: `ollama pull codestral`. The model is around 12 GB at Q4_K_M and requires at least 16 GB RAM or 12 GB VRAMVRAMVideo Random Access Memory (VRAM) is the dedicated memory on graphics cards that stores model weights and the KV cache during LLM inference.Learn more →.

Start a coding session: `ollama run codestral 'Complete this Python function: def binary_search(arr, target):'`. Codestral is optimised for fill-in-the-middle (FIM) prompts — it excels at completing partial code rather than generating from scratch.

Use Codestral as a Continue backend

Continue is an open-source VS Code/JetBrains extension that uses local models for completions. Install Continue from the VS Code marketplace, then add Codestral as a completion model in `.continue/config.json`: set `provider` to `ollama` and `model` to `codestral`.

With this setup, you get Copilot-style inline completions powered entirely by your local machine. The first completion per session may take a few seconds to warm up; subsequent ones are near-instant.

Tips for best coding results

Codestral responds well to explicit language and framework hints. Start your promptPromptThe input text sent to a language model — the question, instruction, or context that triggers a response.Learn more → with the language: 'TypeScript: ...' or include a file extension comment: `// file: auth.ts`. This activates the model's language-specific training.

For debugging, paste the function and the error message together: 'This function throws a TypeError. Here is the code and the error stack trace: [...]'. Codestral will diagnose the issue and suggest a fix with high accuracy.