> ## Documentation Index
> Fetch the complete documentation index at: https://nvd-54.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 模型

> 为深度智能体配置模型提供商和参数

深度智能体可与任何支持[工具调用](/oss/javascript/langchain/models#tool-calling)的 [LangChain 聊天模型](/oss/javascript/langchain/models)配合使用。

## 支持的模型

以 `provider:model` 格式指定模型（例如 `google_genai:gemini-3.1-pro-preview`、`openai:gpt-5.4` 或 `anthropic:claude-sonnet-4-6`）。提供商前缀选择 LangChain 集成，冒号后的部分作为模型标识符传递给该提供商。有关有效的提供商字符串，请参阅 [`init_chat_model`](https://reference.langchain.com/javascript/langchain/chat_models/universal/initChatModel) 的 `model_provider` 参数。有关提供商特定配置，请参阅[聊天模型集成](/oss/javascript/integrations/chat)。

模型标识符必须匹配提供商期望的格式。一些提供商使用简单名称如 `gpt-5.4`；其他的使用命名空间 ID 或部署路径，如 `zai-org/GLM-5.1`，因此完整的深度智能体字符串将是 `baseten:zai-org/GLM-5.1`。请查看提供商的模型目录或集成文档以获取当前标识符。

### 推荐模型

这些模型在[深度智能体评测套件](https://github.com/langchain-ai/deepagents/tree/main/libs/evals#readme)上表现良好，该套件测试基本的智能体操作。通过这些评测是必要条件，但不足以保证在更长、更复杂的任务上有强大表现。

| 提供商                                                           | 模型                                                                                                                                 |
| ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| [Google](/oss/javascript/integrations/providers/google)       | `gemini-3.1-pro-preview`、`gemini-3-flash-preview`                                                                                  |
| [OpenAI](/oss/javascript/integrations/providers/openai)       | `gpt-5.4`、`gpt-4o`、`gpt-5.4`、`o4-mini`、`gpt-5.2-codex`、`gpt-4o-mini`、`o3`                                                          |
| [Anthropic](/oss/javascript/integrations/providers/anthropic) | `claude-opus-4-6`、`claude-opus-4-5`、`claude-sonnet-4-6`、`claude-sonnet-4`、`claude-sonnet-4-5`、`claude-haiku-4-5`、`claude-opus-4-1` |
| 开源权重                                                          | `GLM-5`、`Kimi-K2.5`、`MiniMax-M2.5`、`qwen3.5-397B-A17B`、`devstral-2-123B`                                                           |

开源权重模型可通过 [OpenRouter](/oss/javascript/integrations/chat/openrouter)、[Fireworks](/oss/javascript/integrations/chat/fireworks) 或 [Ollama](/oss/javascript/integrations/chat/ollama) 等提供商获取。

### 模型评测

[深度智能体评测套件](https://github.com/langchain-ai/deepagents/tree/main/libs/evals#readme)测试热门模型：

<div className="deepagents-eval-category-matrix">
  | Model                                        |                                                                        File Ops |                                                                       Retrieval |                                                                       Tool Use |                                                                         Memory |                                                                   Conversation |                                                                   Summarization |
  | :------------------------------------------- | ------------------------------------------------------------------------------: | ------------------------------------------------------------------------------: | -----------------------------------------------------------------------------: | -----------------------------------------------------------------------------: | -----------------------------------------------------------------------------: | ------------------------------------------------------------------------------: |
  | google\_genai:gemini-3.1-pro-preview         | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/25234719085)** | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/25234686782)** |     [25%](https://github.com/langchain-ai/deepagents/actions/runs/25234699517) |     [54%](https://github.com/langchain-ai/deepagents/actions/runs/25290479270) |     [48%](https://github.com/langchain-ai/deepagents/actions/runs/24113831669) |      [80%](https://github.com/langchain-ai/deepagents/actions/runs/25235579950) |
  | openai:gpt-5.4                               | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/24172638583)** | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/24172638583)** |     [18%](https://github.com/langchain-ai/deepagents/actions/runs/24906955930) |     [51%](https://github.com/langchain-ai/deepagents/actions/runs/24172638583) |     [38%](https://github.com/langchain-ai/deepagents/actions/runs/24425363630) | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/24172638583)** |
  | openai:gpt-5.5                               |      [92%](https://github.com/langchain-ai/deepagents/actions/runs/25234719085) | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/25234686782)** |     [20%](https://github.com/langchain-ai/deepagents/actions/runs/25234699517) |     [64%](https://github.com/langchain-ai/deepagents/actions/runs/25232371743) | **[52%](https://github.com/langchain-ai/deepagents/actions/runs/25232371743)** |      [80%](https://github.com/langchain-ai/deepagents/actions/runs/25235579950) |
  | anthropic:claude-opus-4-6                    |      [92%](https://github.com/langchain-ai/deepagents/actions/runs/24172638583) | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/24172638583)** |     [26%](https://github.com/langchain-ai/deepagents/actions/runs/24906955930) | **[69%](https://github.com/langchain-ai/deepagents/actions/runs/24172638583)** |     [22%](https://github.com/langchain-ai/deepagents/actions/runs/24363491527) | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/24172638583)** |
  | anthropic:claude-opus-4-7                    | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/25234719085)** | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/25234686782)** |     [18%](https://github.com/langchain-ai/deepagents/actions/runs/25234699517) |                                                                              — | **[52%](https://github.com/langchain-ai/deepagents/actions/runs/24911513545)** | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/25235579950)** |
  | baseten:moonshotai/Kimi-K2.6                 | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/25234719085)** | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/25234686782)** |     [20%](https://github.com/langchain-ai/deepagents/actions/runs/25234699517) |                                                                              — |                                                                              — |      [60%](https://github.com/langchain-ai/deepagents/actions/runs/25235579950) |
  | baseten:zai-org/GLM-5                        |      [92%](https://github.com/langchain-ai/deepagents/actions/runs/24106499785) | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/24106499785)** | **[87%](https://github.com/langchain-ai/deepagents/actions/runs/24106499785)** |     [44%](https://github.com/langchain-ai/deepagents/actions/runs/23872647281) |     [29%](https://github.com/langchain-ai/deepagents/actions/runs/24106499785) |      [60%](https://github.com/langchain-ai/deepagents/actions/runs/24106499785) |
  | ollama:minimax-m2.7:cloud                    |      [92%](https://github.com/langchain-ai/deepagents/actions/runs/24106499785) |      [90%](https://github.com/langchain-ai/deepagents/actions/runs/24106499785) |     [82%](https://github.com/langchain-ai/deepagents/actions/runs/24106499785) |     [38%](https://github.com/langchain-ai/deepagents/actions/runs/23872647281) |     [29%](https://github.com/langchain-ai/deepagents/actions/runs/24106499785) |      [60%](https://github.com/langchain-ai/deepagents/actions/runs/24106499785) |
  | openrouter:deepseek/deepseek-v4-pro          | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/25234719085)** | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/25234686782)** |     [25%](https://github.com/langchain-ai/deepagents/actions/runs/25234699517) |                                                                              — |                                                                              — |      [80%](https://github.com/langchain-ai/deepagents/actions/runs/25235579950) |
  | openrouter:minimax/minimax-m2.7              |      [92%](https://github.com/langchain-ai/deepagents/actions/runs/25234719085) | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/25234686782)** |     [20%](https://github.com/langchain-ai/deepagents/actions/runs/25234699517) |                                                                              — |                                                                              — |      [60%](https://github.com/langchain-ai/deepagents/actions/runs/25235579950) |
  | openrouter:nvidia/nemotron-3-super-120b-a12b |       [0%](https://github.com/langchain-ai/deepagents/actions/runs/23874487832) |       [0%](https://github.com/langchain-ai/deepagents/actions/runs/23874487832) |      [0%](https://github.com/langchain-ai/deepagents/actions/runs/23874487832) |      [0%](https://github.com/langchain-ai/deepagents/actions/runs/23874487832) |      [0%](https://github.com/langchain-ai/deepagents/actions/runs/23874487832) |       [0%](https://github.com/langchain-ai/deepagents/actions/runs/23874487832) |
  | openrouter:z-ai/glm-5.1                      |      [92%](https://github.com/langchain-ai/deepagents/actions/runs/25234719085) | **[100%](https://github.com/langchain-ai/deepagents/actions/runs/25234686782)** |     [25%](https://github.com/langchain-ai/deepagents/actions/runs/25234699517) |                                                                              — |     [33%](https://github.com/langchain-ai/deepagents/actions/runs/25225620506) |      [80%](https://github.com/langchain-ai/deepagents/actions/runs/25235579950) |
</div>

更多信息请参阅[评测运行记录](https://github.com/langchain-ai/deepagents/actions/workflows/evals.yml)。

## 配置模型参数

将 `provider:model` 格式的模型字符串传递给 [`createDeepAgent`](https://reference.langchain.com/javascript/deepagents/agent/createDeepAgent)，或传入配置好的模型实例以获得完全控制。底层实现中，模型字符串通过 [`init_chat_model`](https://reference.langchain.com/javascript/langchain/chat_models/universal/initChatModel) 解析。

要配置模型特定参数，请使用 [`init_chat_model`](https://reference.langchain.com/javascript/langchain/chat_models/universal/initChatModel) 或直接实例化提供商模型类：

<CodeGroup>
  ```typescript initChatModel theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  import { initChatModel } from "langchain/chat_models/universal";
  import { createDeepAgent } from "deepagents";

  const model = await initChatModel("google_genai:gemini-3.1-pro-preview", {
      reasoningEffort: "medium",  // [!code highlight]
  });
  const agent = createDeepAgent({ model });
  ```

  ```typescript Provider package theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  import { ChatGoogle } from "@langchain/google";
  import { createDeepAgent } from "deepagents";

  const model = new ChatGoogle({
      model: "gemini-3.1-pro-preview",
      reasoningEffort: "medium",  // [!code highlight]
  });
  const agent = createDeepAgent({ model });
  ```
</CodeGroup>

<Note>
  可用参数因提供商而异。请参阅[聊天模型集成](/oss/javascript/integrations/chat)页面了解提供商特定的配置选项。
</Note>

### 提供商配置文件

[`ProviderProfile`](/oss/javascript/deepagents/profiles#provider-profiles) 封装了当你在创建深度智能体时提供 `provider:model` 字符串时应用的初始化参数。当你使用 [`init_chat_model`](https://reference.langchain.com/javascript/langchain/chat_models/universal/initChatModel) 传入预配置模型时，它不会生效。

你可以在两个级别注册，两者可以共存：

* **提供商级别** — 类似 `"openai"` 的纯提供商键适用于来自 `openai` 提供商的每个模型。
* **模型级别** — 类似 `"openai:gpt-5.4"` 的 `provider:model` 键仅适用于该特定模型，并在任何匹配的提供商级别配置文件之上合并。

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from deepagents import ProviderProfile, register_provider_profile

# 提供商范围的默认值：每个 openai 模型都使用 temperature=0。
register_provider_profile(
    "openai",
    ProviderProfile(init_kwargs={"temperature": 0}),
)

# 模型级别覆盖：gpt-5.4 额外获得特定的推理力度。
# 从上面的提供商级别配置文件继承 temperature=0。
register_provider_profile(
    "openai:gpt-5.4",
    ProviderProfile(init_kwargs={"reasoning_effort": "medium"}),
)
```

完整字段列表、合并语义和插件打包请参阅[配置文件](/oss/javascript/deepagents/profiles)。

<Tip>
  要配置模型构建完成后*智能体*的行为方式，请使用[框架配置文件](/oss/javascript/deepagents/profiles#harness-profiles)。
</Tip>

## 运行时选择模型

如果你的应用允许用户选择模型（例如使用 UI 中的下拉菜单），请使用[中间件](/oss/javascript/langchain/middleware)在运行时切换模型，无需重建智能体。

```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { initChatModel, createMiddleware } from "langchain";
import { createDeepAgent } from "deepagents";
import * as z from "zod";

const contextSchema = z.object({
  model: z.string(),
});

const configurableModel = createMiddleware({
  name: "ConfigurableModel",
  wrapModelCall: async (request, handler) => {
    const modelName = request.runtime.context.model;
    const model = await initChatModel(modelName);
    return handler({ ...request, model });
  },
});

const agent = await createDeepAgent({
  model: "google_genai:gemini-3.1-pro-preview",
  middleware: [configurableModel],
  contextSchema,
});

// 使用用户选择的模型调用
const result = await agent.invoke(
  { messages: [{ role: "user", content: "Hello!" }] },
  { context: { model: "openai:gpt-5.4" } },
);
```

<Tip>
  有关更多动态模型模式（例如基于对话复杂度的路由或成本优化），请参阅 LangChain 智能体指南中的[动态模型](/oss/javascript/langchain/agents#dynamic-model)。
</Tip>

## 了解更多

* [LangChain 中的模型](/oss/javascript/langchain/models)：聊天模型功能包括工具调用、结构化输出和多模态

***

<div className="source-links">
  <Callout icon="terminal-2">
    [连接这些文档](/use-these-docs)到 Claude、VSCode 等工具，通过 MCP 获取实时解答。
  </Callout>

  <Callout icon="edit">
    [在 GitHub 上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/oss/deepagents/models.mdx)或[提交问题](https://github.com/langchain-ai/docs/issues/new/choose)。
  </Callout>
</div>
