[Integrations](https://spiral.ai/integrations) › [n8n](https://spiral.ai/integrations/n8n) › [Codestral 2508](https://spiral.ai/integrations/n8n/codestral-2508)

# How to Use Codestral 2508 in n8n

Codestral 2508 is built for code completion, filling gaps in existing code, and focused code generation. Mistral reports 50% fewer runaway generations than prior Codestral releases in its evaluation.

|  |  |
| --- | --- |
| Model | Codestral 2508 |
| Available through | OpenRouter |
| Category | LLM |
| Price | Up to $0.004807 per run at the default inputs. $0.39 per 1M input tokens, $1.17 per 1M output tokens. |
| Returns | text, json |
| Runs | In the background |
| Setup | About 2 minutes, with a Spiral API key |

## Prompts to try with Codestral 2508 in n8n

- Every morning, use Codestral 2508 to draft a minimal correction for each supplied failing function and test report. Return the proposed replacement and a regression test for each case.
- Each weekday, use Codestral 2508 to generate boundary tests for the function snippets submitted in the task queue. Follow the named test framework and explain the behavior each test checks.
- Each evening, use Codestral 2508 to complete the missing sections in the supplied code exercises. Preserve every signature and include assertions matching the supplied expected results.
- Every Monday, use Codestral 2508 to draft one PostgreSQL query for each supplied reporting request and schema. State assumptions about null values and duplicate rows.
- Each night, use Codestral 2508 with low randomness to complete the supplied validation rules. Follow the accompanying example, preserve the specified error messages, and return only the proposed code.

## How to set up Codestral 2508 in n8n

Pick the way that suits you. Each takes about two minutes.

### Use the Spiral skill

1. **Send n8n this message**: Your agent reads Spiral's skill and sets itself up.

```
set up https://spiral.ai/SKILL.md
```

2. **Sign in or paste a key**: Approve Spiral in the browser, or give the agent a key from the console.

### Use Spiral's MCP server

1. **Create a key**: Create a key under API keys in the console.

2. **Add an MCP Client node**: In a workflow, add an MCP Client node (or, under an AI Agent node, an MCP Client Tool) and set:

```text
https://api.spiral.ai/mcp
```

3. **Pick a tool**: The node lists Spiral's tools. In an MCP Client node pick one, such as `run`, and give it its arguments:

```json
{
  "provider": "fal",
  "model": "fal-ai/flux/schnell",
  "input": { "prompt": "a lighthouse at dawn" },
  "wait": true
}
```

4. **Run Codestral 2508 in a workflow step**: Give the step an instruction like the ones below and run it on your trigger or schedule. Spiral finds Codestral 2508, prices it and runs it each time the step fires.

### Use the Spiral CLI

1. **Install and sign in**: Installs the Spiral CLI, signs you in and adds its skill to your coding agents.

```bash
npx -y spiral-cli@latest init
```

### Call the Spiral API

1. **Create an API key**: In the console, under API keys.

2. **Run Codestral 2508**: One request; the result comes back by polling or a webhook.

```bash
curl https://api.spiral.ai/v1/runs \
  -H "Authorization: Bearer $SPIRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "provider": "openrouter",
    "model": "mistralai/codestral-2508",
    "input": {
      "messages": [
        {
          "role": "system"
        }
      ]
    }
  }'
```

Then paste one of the prompts above: n8n finds Codestral 2508 on Spiral, shows the price and runs it.

Setup guide in the docs: https://spiral.ai/docs/quickstarts/n8n

## Codestral 2508 tools and prices

- [Mistral: Codestral 2508](https://spiral.ai/tools/openrouter/mistralai/codestral-2508) (OpenRouter): Up to $0.004807 per run at the default inputs. $0.39 per 1M input tokens, $1.17 per 1M output tokens.

## Settings you can ask for

| Setting | Allowed values | Default | Description |
| --- | --- | --- | --- |
| seed |  | — |  |
| stop |  | — |  |
| tools |  | — |  |
| top_p | 0 to 1 | — |  |
| max_tokens | 1 to 204800 | — | The most output tokens to generate. |
| temperature | 0 to 2 | — |  |

## What can you do with Codestral 2508 in n8n?

Codestral can turn supplied coding tasks into recurring batches of proposed fixes, completions, and tests. Keep each scheduled request focused on one snippet and one expected result.

### Complete an unfinished function

Ask Codestral 2508 to fill a missing function body using the surrounding code, signature, and expected results.

### Implement a small helper

Give Codestral 2508 a focused specification for a parser, validator, or data transformation. Include examples of accepted and rejected inputs.

### Draft a targeted bug fix

Provide Codestral 2508 with the failing function, observed result, and expected result. Request the smallest proposed correction.

### Write regression tests

Ask Codestral 2508 for tests covering a reported failure, boundary inputs, and normal behavior in your chosen test framework.

### Generate a query from a schema

Supply Codestral 2508 with table definitions, the SQL dialect, and the desired result. Request one query with explicit handling of nulls and duplicates.

### Complete repetitive validation code

Show Codestral 2508 an existing validation rule and ask it to complete the remaining rules in the same style, with exact error messages.

### Create a runnable example

Ask Codestral 2508 to turn a narrow coding requirement into a complete example with imports, a function, and assertions for the expected results.

## Overview

- [OpenRouter](https://spiral.ai/providers/openrouter)
- [All n8n guides](https://spiral.ai/integrations/n8n)

## Codestral 2508 in other agents

- [Amp](https://spiral.ai/integrations/amp/codestral-2508)
- [ChatGPT](https://spiral.ai/integrations/chatgpt/codestral-2508)
- [Claude](https://spiral.ai/integrations/claude-desktop/codestral-2508)
- [Claude Code](https://spiral.ai/integrations/claude-code/codestral-2508)
- [Cline](https://spiral.ai/integrations/cline/codestral-2508)
- [Codex](https://spiral.ai/integrations/codex/codestral-2508)
- [Cursor](https://spiral.ai/integrations/cursor/codestral-2508)
- [Devin](https://spiral.ai/integrations/devin/codestral-2508)
- [dots](https://spiral.ai/integrations/dots/codestral-2508)
- [Factory Droid](https://spiral.ai/integrations/factory-droid/codestral-2508)
- [Gemini](https://spiral.ai/integrations/gemini/codestral-2508)
- [Gemini CLI](https://spiral.ai/integrations/gemini-cli/codestral-2508)
- [Google Antigravity](https://spiral.ai/integrations/antigravity/codestral-2508)
- [goose](https://spiral.ai/integrations/goose/codestral-2508)
- [Grok](https://spiral.ai/integrations/grok/codestral-2508)
- [Grok Build](https://spiral.ai/integrations/grok-build/codestral-2508)
- [Hermes](https://spiral.ai/integrations/hermes/codestral-2508)
- [Instinct](https://spiral.ai/integrations/instinct/codestral-2508)
- [Manus](https://spiral.ai/integrations/manus/codestral-2508)
- [Muse](https://spiral.ai/integrations/muse/codestral-2508)
- [Muse Code](https://spiral.ai/integrations/muse-code/codestral-2508)
- [Notion](https://spiral.ai/integrations/notion/codestral-2508)
- [OpenClaw](https://spiral.ai/integrations/openclaw/codestral-2508)
- [opencode](https://spiral.ai/integrations/opencode/codestral-2508)
- [Perplexity](https://spiral.ai/integrations/perplexity/codestral-2508)
- [Raycast](https://spiral.ai/integrations/raycast/codestral-2508)
- [VS Code](https://spiral.ai/integrations/vscode/codestral-2508)
- [Windsurf](https://spiral.ai/integrations/windsurf/codestral-2508)
- [Zapier](https://spiral.ai/integrations/zapier/codestral-2508)

## More n8n guides

- [Claude Sonnet Latest](https://spiral.ai/integrations/n8n/claude-sonnet-latest)
- [Command A](https://spiral.ai/integrations/n8n/command-a)
- [Claude Sonnet 5.5](https://spiral.ai/integrations/n8n/claude-sonnet-5-5)
- [Command A Plus](https://spiral.ai/integrations/n8n/command-a-plus)
- [Claude Sonnet 5](https://spiral.ai/integrations/n8n/claude-sonnet-5)
- [Command R (08-2024)](https://spiral.ai/integrations/n8n/command-r-08-2024)

## Questions about Codestral 2508 in n8n

**Can n8n use Codestral 2508?**

Yes. Add Spiral to n8n as an MCP server, and n8n can find and run Codestral 2508 like any built-in tool.

**How much does Codestral 2508 cost in n8n?**

Up to $0.004807 per run at the default inputs. $0.39 per 1M input tokens, $1.17 per 1M output tokens. You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your n8n plan is separate.

**Do I need an OpenRouter account to use Codestral 2508 in n8n?**

You need no OpenRouter account. n8n uses one Spiral API key for every tool, and Spiral runs Codestral 2508 on its own OpenRouter account.

**How long does it take to set up Codestral 2508 in n8n?**

About two minutes: create a key, then add an MCP Client node, then pick a tool.

**Does n8n wait while Codestral 2508 runs?**

Codestral 2508 runs in the background. n8n starts the run, checks on it and gives you the text, json when it's ready.

**What is Codestral best suited to?**

Codestral is designed for frequent code completions, filling gaps in existing code, and generating code from instructions. Start with a bounded task, such as completing one function or implementing one helper.

**Can Codestral complete code between two existing sections?**

Yes. Filling gaps in partial code is a core Codestral task. Include the surrounding code and clearly identify the section you want completed.

**Does Codestral support multiple programming languages?**

Yes. Mistral describes Codestral 2508 as supporting a wide range of languages and tasks. Name the target language, runtime, and dependencies in your request.

**Which settings matter for focused code generation?**

Start with a low temperature, around 0.2, for focused completions. Mistral recommends adjusting temperature or top-p, rather than changing both together.

**How much code should I include in a request?**

Include the relevant function, its dependencies, and the expected behavior. Leave room for the answer: context accounting includes both your input and the generated output.

