API · Models
Text

Codestral

Codestral is Mistral's specialized coding model with a 256K context window, optimized for code generation, completion, and software engineering tasks.

Context 256K·Max out 256K

Quickstart

import { streamText } from 'ai';
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';

const blackbox = createOpenAICompatible({
  name: 'blackbox',
  apiKey: process.env.BLACKBOX_API_KEY!,
  baseURL: 'https://api.blackbox.ai/v1',
});

const result = streamText({
  model: blackbox('blackboxai/mistral/codestral'),
  prompt: 'Why is the sky blue?',
});

for await (const chunk of result.textStream) {
  process.stdout.write(chunk);
}

Specs & pricing

Input $/M
0.3
Output $/M
0.9
Context window
256K
Max output
256K
Supported parameters
tool-usejson-modestreaming

Related models

ModelTypeContextInput $/M
Mistral Medium 3.5Text262.1K1.50
Devstral 2Text256K0.4
Mistral SmallText128K0.075
Mistral NemoText131.1K0.02
Ministral 8BText262.1K0.15