Skip to content

模型配置大全

虾饺支持所有 OpenAI 兼容 API 的模型。本页提供每个主流 Provider 的详细配置方法。若尚未本地跑通服务,请先 快速开始。配好模型后若要精简人格与省 token,可配合 SOUL.md 编写指南 调整各 Agent 的 SOUL.md

全局设置面板 — 主题、语言与默认 LLM 模型

全局设置面板 — 可切换主题、语言,并选择默认 LLM 模型

Agent 名片 — 模型选择器为每个 Agent 指定独立模型

Agent 名片 — 模型选择器下拉菜单支持为每个 Agent 指定独立模型

配置入口

登录虾饺后,进入:

设置 → 模型管理 → 添加配置

每个 Provider 需要填写:

字段说明
名称随便取,方便识别(如"通义千问")
API Base URLProvider 的 API 地址
API Key认证密钥
API 类型openai-completionsanthropic-messages
默认模型该 Provider 下的默认模型名

OpenAI

字段
API Base URLhttps://api.openai.com/v1
API 类型openai-completions
获取 Keyplatform.openai.com/api-keys

推荐模型

模型特点价格
gpt-4o最新旗舰,多模态$5/M input, $15/M output
gpt-4o-mini轻量版,性价比高$0.15/M input, $0.6/M output
gpt-4-turbo上一代旗舰$10/M input, $30/M output
o1推理增强$15/M input, $60/M output

最佳实践

  • 日常聊天:gpt-4o-mini(便宜够用)
  • 复杂任务:gpt-4o
  • 代码生成:gpt-4o(代码能力强)

Anthropic(Claude)

字段
API Base URLhttps://api.anthropic.com
API 类型anthropic-messages
获取 Keyconsole.anthropic.com

API 类型

Claude 必须选择 anthropic-messages 类型,不是 openai-completions

推荐模型

模型特点价格
claude-sonnet-4-20250514旗舰模型,代码和推理极强$3/M input, $15/M output
claude-3-5-haiku-20241022轻量快速$1/M input, $5/M output
claude-opus-4-20250514最强推理$15/M input, $75/M output

最佳实践

  • 代码生成:Claude Sonnet(公认代码能力最强的模型之一)
  • 长文写作:Claude Sonnet(200K 上下文窗口)
  • 省钱:Claude Haiku

通义千问(阿里云)

字段
API Base URLhttps://dashscope.aliyuncs.com/compatible-mode/v1
API 类型openai-completions
获取 Keydashscope.console.aliyun.com

推荐模型

模型特点价格
qwen-max旗舰¥20/M input, ¥60/M output
qwen-plus平衡¥0.8/M input, ¥2/M output
qwen-turbo快速便宜¥0.3/M input, ¥0.6/M output
qwen-long长文本¥0.5/M input, ¥2/M output

最佳实践

  • 日常使用:qwen-turbo(几分钱一天)
  • 复杂任务:qwen-plus(性价比最高)
  • 最高质量:qwen-max

新用户福利

通义千问新注册用户通常有免费额度,具体以官网为准。

DeepSeek

字段
API Base URLhttps://api.deepseek.com
API 类型openai-completions
获取 Keyplatform.deepseek.com

推荐模型

模型特点价格
deepseek-chat通用对话¥1/M input, ¥2/M output
deepseek-coder代码专精¥1/M input, ¥2/M output
deepseek-reasoner推理增强¥4/M input, ¥16/M output

最佳实践

  • 性价比之王:DeepSeek 的价格只有 GPT-4o 的 1/10,但质量接近
  • 代码任务用 deepseek-coder
  • 日常聊天用 deepseek-chat

Kimi(月之暗面)

字段
API Base URLhttps://api.moonshot.cn/v1
API 类型openai-completions
获取 Keyplatform.moonshot.cn

推荐模型

模型特点价格
moonshot-v1-8k8K 上下文¥12/M tokens
moonshot-v1-32k32K 上下文¥24/M tokens
moonshot-v1-128k128K 上下文¥60/M tokens

最佳实践

  • 日常使用 8K 版本
  • 长文档处理用 128K 版本

GLM(智谱)

字段
API Base URLhttps://open.bigmodel.cn/api/paas/v4
API 类型openai-completions
获取 Keyopen.bigmodel.cn

推荐模型

模型特点价格
glm-4-plus旗舰¥50/M tokens
glm-4-flash快速免费免费
glm-4-long长文本¥1/M tokens

免费模型

glm-4-flash 完全免费,适合尝试和轻度使用。

Ollama(本地模型)

字段
API Base URLhttp://localhost:11434/v1
API 类型openai-completions
API Key不需要(留空或填 ollama

安装 Ollama

bash
# macOS / Linux
curl -fsSL https://ollama.com/install.sh | sh

# Windows
# 从 https://ollama.com/download 下载安装包

下载模型

bash
ollama pull llama3.1         # Meta Llama 3.1(8B)
ollama pull qwen2.5          # 通义千问 2.5
ollama pull mistral          # Mistral 7B
ollama pull codellama        # 代码专精
ollama pull deepseek-coder-v2 # DeepSeek Coder V2

硬件要求

模型大小最低显存推荐显存
7B4GB8GB
13B8GB16GB
70B40GB48GB+

没有显卡也能跑(用 CPU),但会很慢。

最佳实践

  • 完全免费完全私有完全离线
  • 适合对隐私敏感的场景
  • 推荐 8B 级别的模型(7B-8B),在消费级 GPU 上运行流畅
  • 中文推荐 qwen2.5

OpenRouter(聚合平台)

字段
API Base URLhttps://openrouter.ai/api/v1
API 类型openai-completions
获取 Keyopenrouter.ai/keys

OpenRouter 聚合了 100+ 模型,通过一个 API Key 访问所有模型。适合想要灵活切换模型的用户。

常用模型

openai/gpt-4o
anthropic/claude-3.5-sonnet
google/gemini-pro-1.5
meta-llama/llama-3.1-70b-instruct

多 Provider 混合配置

虾饺支持同时配置多个 Provider,为不同 Agent 分配不同模型。

推荐配置方案

Agent推荐 Provider推荐模型理由
🤖 虾饺管家通义千问qwen-turbo系统任务简单,省钱
✍️ 小说家Claudeclaude-sonnet创作质量高
📝 编辑DeepSeekdeepseek-chat文字处理够用,便宜
🌐 翻译官OpenAIgpt-4o多语言能力最强
💻 代码助手Claudeclaude-sonnet代码能力最强

纯省钱方案

AgentProvider模型月费估算
所有 Agent通义千问qwen-turbo< ¥5/月

最佳体验方案

AgentProvider模型月费估算
创作类Claudeclaude-sonnet~$10/月
工具类OpenAIgpt-4o~$10/月

完全免费方案

AgentProvider模型
所有 AgentOllamaqwen2.5 / llama3.1

省钱攻略

原则

  1. 按任务匹配模型:不是所有任务都需要 GPT-4o / Claude Opus
  2. 翻译、总结、格式转换用便宜模型;创作、代码、推理用贵模型
  3. SOUL.md 越精准,prompt token 越少,每次调用省几百 token

成本对比实测

以一条"写 500 字技术博客"为例,不同模型的成本:

模型Input tokensOutput tokens单次成本
GPT-4o~800~600~$0.012
Claude Sonnet~800~600~$0.009
DeepSeek Chat~800~600~¥0.004
Qwen Turbo~800~600~¥0.003
Ollama (本地)~800~600¥0

省钱配置示例

虾饺管家(系统管理)→ Qwen Turbo(¥0.003/千tokens,够用)
翻译官(翻译任务)→ DeepSeek Chat(便宜且翻译质量不错)
代码助手(代码生成)→ Claude Sonnet(代码质量高,值得花钱)
日常闲聊 Agent → Ollama qwen2.5(免费)

控制 token 消耗的技巧

  1. 精简 SOUL.md:去掉冗余描述,每少 100 字 = 每次调用省 ~100 tokens
  2. 限制记忆注入数量AUTO_MEMORY_TOP_K=3,只注入最相关的 3 条
  3. 关闭不需要的工具:每个工具定义约 100-200 tokens
  4. 短对话多开新会话:避免历史消息累积拉高 input token

配置排错

API Key 无效

症状:Agent 回复报错 "401 Unauthorized"

解决:检查 API Key 是否正确复制(前后不要有空格),确认 Key 没有过期。

API Base URL 错误

症状:Agent 回复报错 "ECONNREFUSED" 或 "404"

解决:确认 URL 格式正确。常见错误:

  • https://api.openai.com(缺少 /v1
  • https://api.openai.com/v1
  • http://localhost:11434(Ollama 缺少 /v1
  • http://localhost:11434/v1

模型名称错误

症状:Agent 回复报错 "model not found"

解决:确认模型名称拼写正确。模型名称区分大小写。

Claude API 不工作

症状:调用 Claude 报错

解决:确认 API 类型选择了 anthropic-messages(不是 openai-completions)。

Ollama 连接失败

症状:调用 Ollama 报错 "ECONNREFUSED"

解决

  1. 确认 Ollama 正在运行:ollama list
  2. 确认端口正确:默认 11434
  3. 如果虾饺和 Ollama 在不同机器上,确认 Ollama 绑定了 0.0.0.0

配置验证清单

配完一个 Provider 后,快速验证:

✅ API Base URL 末尾带 /v1(OpenAI 兼容协议)
✅ API Key 无空格、无换行
✅ 模型名称与 Provider 文档一致
✅ API 类型正确(Anthropic 选 anthropic-messages,其他选 openai-completions)
✅ 创建一个测试 Agent,发一条消息验证回复

相关文档

基于 MIT 协议开源 · GitHub · 社区