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

# Responses格式

# 聊天 (Chat) - Responses 格式 (原生 OpenAI)

OpenAI Responses API，用于创建模型响应。支持多轮对话、工具调用、推理等功能。

* **接口地址**: `POST /v1/responses`
* **基础 URL (示例)**: `https://www.ominiapi.com`

## 认证与请求头 (Headers)

* `Authorization` (**必选**): 使用 Bearer Token 认证。格式: `Bearer sk-xxxxxx`
* `Content-Type`: `application/json`

## 请求参数 (Request Body)

| 参数名                    | 类型                   | 必选    | 说明                           |
| :--------------------- | :------------------- | :---- | :--------------------------- |
| `model`                | String               | **是** | 模型名称                         |
| `input`                | String / ArrayObject | 否     | 输入内容，可以是字符串或消息数组             |
| `instructions`         | String               | 否     | 系统指令或系统提示词                   |
| `max_output_tokens`    | Integer              | 否     | 最大输出 Token 数量                |
| `temperature`          | Number               | 否     | 采样温度                         |
| `top_p`                | Number               | 否     | 核采样参数                        |
| `stream`               | Boolean              | 否     | 是否启用流式响应                     |
| `tools`                | ArrayObject          | 否     | 可调用的工具列表                     |
| `tool_choice`          | String / Object      | 否     | 工具选择模式控制                     |
| `reasoning`            | Object               | 否     | 推理相关配置                       |
| `previous_response_id` | String               | 否     | 上一轮响应的 ID，用于延续对话上下文          |
| `truncation`           | String               | 否     | 截断策略，可选值: `auto`, `disabled` |

## 示例代码 (cURL)

```bash theme={null}
curl -X POST "[https://www.ominiapi.com/v1/responses](https://www.ominiapi.com/v1/responses)" \
  -H "Authorization: Bearer <您的_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "input": "你好，请自我介绍一下。"
  }'
```

## 响应体结构 (Response - 200 OK)

成功请求返回 JSON 格式结果。

```bash theme={null}
{
  "id": "string",
  "object": "response",
  "created_at": 0,
  "status": "completed",
  "model": "string",
  "output": [
    {
      "type": "string",
      "id": "string",
      "status": "string",
      "role": "string",
      "content": [
        {
          "type": "string",
          "text": "string"
        }
      ]
    }
  ],
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "text_tokens": 0,
      "audio_tokens": 0,
      "image_tokens": 0
    },
    "completion_tokens_details": {
      "text_tokens": 0,
      "audio_tokens": 0,
      "reasoning_tokens": 0
    }
  }
}
```
