Mistral AI
Mistral 是現役 Small 和 Medium 產品線背後的法國實驗室。Mixtral 8x7B 已於 2025 年 3 月 30 日從 API 退役。主控台仍然只用電子郵件就發金鑰;Free mode 和 Labs 是不要卡的部分。
Mistral 是現役 Small 和 Medium 產品線背後的法國實驗室。Mixtral 8x7B 已於 2025 年 3 月 30 日從 API 退役。主控台仍然只用電子郵件就發金鑰;Free mode 和 Labs 是不要卡的部分。
上下文最高 256K。Labs id(labs- 前綴)免費;mistral-medium-3-5 收費。限額按組織在主控台裡設定,沒有公布的「每秒一次」之類。拿 Small 或 Labs 模型來試,別拿來上線。
- 免費模型
- 12
- 最大上下文
- 256K
- 免費額度
- Free mode 與 Labs
- 註冊要求
- 只要電子郵件,不要卡
端點
基底網址
https://api.mistral.ai/v1環境變數
MISTRAL_API_KEY速率限制
Per-org caps in the console; Labs models are free of charge- OpenAI 相容
- 官方 SDK:Mistral SDK
- 文字
- 影像
- 程式碼
程式碼範例
npm install openaiimport OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://api.mistral.ai/v1',
apiKey: process.env.MISTRAL_API_KEY
})
const response = await client.chat.completions.create({
model: 'mistral-small-latest',
messages: [{ role: 'user', content: 'Explain closures in one paragraph.' }]
})
console.log(response.choices[0].message.content)pip install openaiimport os
from openai import OpenAI
client = OpenAI(
base_url="https://api.mistral.ai/v1",
api_key=os.environ["MISTRAL_API_KEY"],
)
response = client.chat.completions.create(
model="mistral-small-latest",
messages=[{"role": "user", "content": "Explain closures in one paragraph."}],
)
print(response.choices[0].message.content)curl https://api.mistral.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MISTRAL_API_KEY" \
-d '{
"model": "mistral-small-latest",
"messages": [{"role": "user", "content": "Explain closures in one paragraph."}]
}'npm install @mistralai/mistralaiimport { Mistral } from '@mistralai/mistralai'
const client = new Mistral({ apiKey: process.env.MISTRAL_API_KEY })
const response = await client.chat.complete({
model: 'mistral-small-latest',
messages: [{ role: 'user', content: 'Explain closures in one paragraph.' }]
})
console.log(response.choices[0].message.content)pip install mistralaiimport os
from mistralai import Mistral
client = Mistral(api_key=os.environ["MISTRAL_API_KEY"])
response = client.chat.complete(
model="mistral-small-latest",
messages=[{"role": "user", "content": "Explain closures in one paragraph."}],
)
print(response.choices[0].message.content)值得注意
- open-mixtral-8x7b 已於 2025 年 3 月 30 日退役。請用 mistral-small-latest 或 labs- 前綴的 id。
- mistral-medium-3-5 是付費模型(256K)。Free mode 和 Labs 才是不要卡的部分。
你能免費使用的模型12
- Mistral Small
mistral-small-latest - Mistral Small 2506
mistral-small-2506 - Mistral Nemo
open-mistral-nemo - Codestral
codestral-latest - Pixtral 12B
pixtral-12b-2409 - Labs Mistral Small
labs-mistral-small - Mistral Embed
mistral-embed - Mistral Moderation
mistral-moderation-latest - Mistral OCR
ocr-latest - Mistral Small 3.1
mistral-small-3.1-24b-instruct - Devstral Small
devstral-small-latest - Magistral Small
magistral-small-latest