返回模型列表
Codestral
mistralmistral/codestral
API 使用指南
Chat 调用
标准 OpenAI 兼容的聊天补全。Codestral 对明确的代码生成提示响应最佳。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "mistral/codestral",
"messages": [
{"role": "user", "content": "Write a Python function to merge two sorted arrays into one sorted array."}
],
"temperature": 0.2
}'流式输出
逐 token 流式输出,实现更快的 IDE 内联建议或渐进式代码展示。
cURL
curl https://api.therouter.ai/v1/chat/completions \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "mistral/codestral",
"messages": [{"role": "user", "content": "Explain how binary search works in Python"}],
"stream": true
}'事实档案 — 本页每条断言可在此回溯来源
| 来源 | URL | 采集于 | |
|---|---|---|---|
| 发布日期 | mistral.ai ↗ | 2026-05-27 | 已核实 |
| 架构 | huggingface.co ↗ | 2026-05-27 | 待核实 |
| 上下文窗口 | mistral.ai ↗ | 2026-05-27 | 已核实 |
| 原生 fill-in-the-middle (FIM) | mistral.ai ↗ | 2026-05-27 | 已核实 |
| 支持语言 | mistral.ai ↗ | 2026-05-27 | 已核实 |
| 许可 | huggingface.co ↗ | 2026-05-27 | 已核实 |
| 后继版本 | — | — | 已核实 |
| HumanEval pass@1 | mistral.ai ↗ | 2026-05-27 | 已核实 |
| HumanEval pass@1 | mistral.ai ↗ | 2026-05-27 | 已核实 |
| HumanEval FIM average | mistral.ai ↗ | 2026-05-27 | 已核实 |
| MBPP sanitized pass@1 | mistral.ai ↗ | 2026-05-27 | 已核实 |
| CruxEval | mistral.ai ↗ | 2026-05-27 | 已核实 |
| RepoBench EM | mistral.ai ↗ | 2026-05-27 | 已核实 |
| Spider SQL | overchat.ai ↗ | 2026-05-27 | 待核实 |
| Codestral 25.08:可接受建议增加 30%,完整 Mistral 编码栈发布 | mistral.ai ↗ | 2026-05-27 | 已核实 |
| Codestral 25.01:256K 上下文、2 倍速度、改进的 FIM | mistral.ai ↗ | 2026-05-27 | 已核实 |
| Codestral 适合做通用聊天机器人吗? | mistral.ai ↗ | 2026-05-27 | 待核实 |
| 什么是 fill-in-the-middle(FIM),为什么重要? | mistral.ai ↗ | 2026-05-27 | 待核实 |
| 我可以在自己的代码库上微调 Codestral 吗? | huggingface.co ↗ | 2026-05-27 | 待核实 |
| Codestral 与 Devstral 2 相比如何? | mistral.ai ↗ | 2026-05-27 | 待核实 |