Codestral fill-in-the-middle completion
codestral_fimGenerate code between a given prefix and suffix for editor autocomplete, code patching, or structured refactors.
Instructions
Fill-in-the-middle code completion with Codestral.
Given prompt (code preceding the cursor) and suffix (code after the cursor),
Codestral writes the middle. Use for editor autocomplete scenarios, code-patching
agents, or structured refactors where you know the target boundaries.
Default stop tokens: [] — let the model decide. Override with stop if needed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | Random seed for deterministic sampling. Maps to Mistral's `random_seed`. | |
| stop | No | Stop generation when any of these text sequences is encountered. | |
| model | No | FIM (fill-in-the-middle) model identifier. Any identifier your endpoint serves is accepted — read mistral://models for the live catalog. Known Mistral aliases: codestral-latest. | |
| top_p | No | Nucleus sampling probability mass: 0.1 considers tokens in the top 10% of probability mass. Prefer adjusting this or temperature, not both. | |
| prompt | Yes | Code preceding the cursor. | |
| suffix | Yes | Code after the cursor. Can be empty string. | |
| max_tokens | No | Maximum number of tokens to generate. Input tokens plus this limit must fit within the model's context length. | |
| temperature | No | Sampling temperature: higher values make output more random; lower values make it more focused. Prefer adjusting this or top_p, not both. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| model | Yes | ||
| usage | No | ||
| finish_reason | No |