> ## 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.

# OpenAI Responses

> 了解如何使用 Agno 中的 OpenAI Responses。

`OpenAIResponses` 是一个用于通过 Responses API 与 OpenAI 模型进行交互的类。此类提供了一个简化的接口，用于使用 OpenAI 的新 Response API，这与传统的 Chat API 不同。它支持工具使用、文件处理和知识检索等高级功能。

## 身份验证

设置你的 `OPENAI_API_KEY` 环境变量。你可以在[此处](https://platform.openai.com/account/api-keys)从 OpenAI 获取一个。

<CodeGroup>
  ```bash Mac theme={null}
  export OPENAI_API_KEY=sk-***
  ```

  ```bash Windows theme={null}
  setx OPENAI_API_KEY sk-***
  ```
</CodeGroup>

## 示例

在你的 `Agent` 中使用 `OpenAIResponses`：

<CodeGroup>
  ```python agent.py theme={null}

  from agno.agent import Agent
  from agno.media import File
  from agno.models.openai.responses import OpenAIResponses

  agent = Agent(
      model=OpenAIResponses(id="gpt-4o-mini"),
      tools=[{"type": "file_search"}, {"type": "web_search_preview"}],
      markdown=True,
  )

  agent.print_response(
      "Summarize the contents of the attached file and search the web for more information.",
      files=[File(url="https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf")],
  )

  ```
</CodeGroup>

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

## 参数

有关更多信息，也请参阅[OpenAI Responses 文档](https://platform.openai.com/docs/api-reference/responses)。

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

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