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

# DeepInfra

> 了解如何在 Agno 中使用 DeepInfra 模型。

利用 DeepInfra 强大的命令模型以及更多功能。

[DeepInfra](https://deepinfra.com) 支持广泛的模型。在此处查看其模型库：[https://deepinfra.com/models](https://deepinfra.com/models)。

我们建议您进行实验，以找到最适合您用例的模型。以下是一些通用建议：

* `deepseek-ai/DeepSeek-R1-Distill-Llama-70B` 模型适用于推理。
* `meta-llama/Llama-2-70b-chat-hf` 模型适用于基本用例。
* `meta-llama/Llama-3.3-70B-Instruct` 模型适用于多步任务。

DeepInfra 有速率限制。有关更多信息，请参阅文档：[https://deepinfra.com/docs/advanced/rate-limits](https://deepinfra.com/docs/advanced/rate-limits)。

## 身份验证

设置您的 `DEEPINFRA_API_KEY` 环境变量。在此处获取您的密钥：[https://deepinfra.com/dash/api\_keys](https://deepinfra.com/dash/api_keys)。

<CodeGroup>
  ```bash Mac theme={null}
  export DEEPINFRA_API_KEY=***
  ```

  ```bash Windows theme={null}
  setx DEEPINFRA_API_KEY ***
  ```
</CodeGroup>

## 示例

在您的 `Agent` 中使用 `DeepInfra`：

<CodeGroup>
  ```python agent.py theme={null}
  from agno.agent import Agent, RunResponse
  from agno.models.deepinfra import DeepInfra

  agent = Agent(
      model=DeepInfra(id="meta-llama/Llama-2-70b-chat-hf"),
      markdown=True
  )

  # 在终端中打印响应
  agent.print_response("Share a 2 sentence horror story.")

  ```
</CodeGroup>

<Note>在此处查看更多示例：[../examples/models/deepinfra](../examples/models/deepinfra)。</Note>

## 参数

<Snippet file="model-deepinfra-params.mdx" />

`DeepInfra` 是 `Model` 类的一个子类，并且可以访问相同的参数。
