Skip to content
广告 · 本站推荐广告

Mistral ​

Mistral AI 是欧洲领先的 AI 公司,提供高性能的开源和闭源大语言模型。

获取 API Key ​

  1. 前往 Mistral AI 控制台 注册账号
  2. 在「API Keys」页面创建 API Key
  3. 复制 API Key

配置 OpenClaw ​

bash
openclaw models auth login --provider mistral
# 按提示输入 API Key

或手动编辑配置文件:

jsonc
// ~/.openclaw/config.json
{
  "models": {
    "providers": {
      "mistral": {
        "apiKey": "xxxxxxxxxxxxxxxxxxxxxxxx",
        "baseUrl": "https://api.mistral.ai/v1"
      }
    }
  }
}

支持的模型 ​

模型 ID说明上下文窗口
mistral-large-latest旗舰模型,综合能力最强128K
mistral-medium-latest均衡版本32K
mistral-small-latest轻量快速版32K
codestral-latest编程专用模型32K
open-mistral-nemo开源模型,12B 参数128K

使用示例:

bash
openclaw models default set mistral/mistral-large-latest
openclaw chat "请用 Python 实现一个快速排序算法"

环境变量 ​

bash
export MISTRAL_API_KEY="xxxxxxxxxxxxxxxxxxxxxxxx"

故障排查 ​

API 调用失败 ​

  • 确认 API Key 有效
  • 检查账户余额

模型不可用 ​

  • 确认模型 ID 正确
  • 部分模型可能需要特定的订阅计划

🇨🇳 中国用户须知

  • 网络代理:Mistral API 需要从中国大陆配置代理访问
    bash
    export HTTPS_PROXY="http://127.0.0.1:7890"
  • 替代方案:Mistral 的开源模型可以通过 Ollama 在本地运行,无需网络
  • Codestral:如果需要编程辅助且无法访问 Mistral API,推荐使用 DeepSeek

基于MIT协议开源 | 内容翻译自 官方文档,同步更新