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

# Responses 接入

> 使用 OpenAI Responses 格式发送文本请求。

APIONE 提供 `POST /v1/responses`。使用 Codex 或基于 Responses 的应用时，先确认所选模型支持此协议；Chat Completions 的请求体不能直接复用。

## 发送最小请求

先按[快速开始](https://apione.ai/docs/quickstart.md)设置 `APIONE_API_KEY` 和 `APIONE_MODEL`。模型 ID 从[可用模型](https://apione.ai/docs/models/catalog.md)中选择。下面是 Responses 的基础文本格式：

```bash theme={null}
curl --fail-with-body --max-time 120 https://api.apione.ai/v1/responses \
  -H "Authorization: Bearer ${APIONE_API_KEY:?请先设置 APIONE_API_KEY}" \
  -H "Content-Type: application/json" \
  --data "{\"model\":\"${APIONE_MODEL:?请先设置 APIONE_MODEL}\",\"input\":\"Hello\"}"
```

`input` 是本次输入。成功响应按 Responses 格式返回 `output[]`；读取其中 `type: "message"` 的项目，再遍历其 `content[]`，提取 `type: "output_text"` 的 `text`。不要用 Chat Completions 的 `choices[0].message.content` 读取。

## SDK 与客户端配置

OpenAI SDK 的 Base URL 填 `https://api.apione.ai/v1`，由 SDK 拼接 `/responses`。需要完整端点的客户端则填 `https://api.apione.ai/v1/responses`。Codex 的设置见[接入教程](https://apione.ai/docs/guides/codex.md)。

先验证文本，再按模型能力加入工具和流式输出。协议兼容不代表存储、后台任务、内置工具及所有扩展字段都可用；这些能力需要单独确认。失败时保留状态码、错误正文和实际返回的请求标识及字段名，见[错误排查](https://apione.ai/docs/support/errors.md)。

接口依据：[APIONE 端点说明](https://apione.ai/zh/api-docs/docs/endpoints)。基础格式参考：[OpenAI Responses](https://developers.openai.com/api/reference/resources/responses/methods/create)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.