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

# Responses

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

<RequestExample>
  ```bash cURL theme={null} theme={null}
  curl --request POST \
    --url 'https://api.elkapi.com/v1/responses' \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
    "model": "gpt-5.5",
    "input": "今天天气真好，适合出去散步。",
    "temperature": 1,
    "stream": false
  }'
  ```

  ```python Python theme={null} theme={null}
  import requests

  url = "https://api.elkapi.com/v1/responses"
  headers = {
      "Authorization": "Bearer <token>"
  }
  headers["Content-Type"] = "application/json"
  payload = {
      "model": "gpt-5.5",
      "input": "今天天气真好，适合出去散步。",
      "temperature": 1,
      "stream": False
  }

  response = requests.request("POST", url, headers=headers, json=payload)
  print(response.json())
  ```

  ```javascript JavaScript theme={null} theme={null}
  const url = "https://api.elkapi.com/v1/responses";

  const headers = {
    "Authorization": "Bearer <token>"
  };
  headers["Content-Type"] = "application/json";
  const payload = {
    "model": "gpt-5.5",
    "input": "今天天气真好，适合出去散步。",
    "temperature": 1,
    "stream": false
  };

  const response = await fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(payload)
  });

  console.log(await response.json());
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null} theme={null}
  {
    "id": "id",
    "object": "response",
    "created_at": 1,
    "status": "completed",
    "model": "gpt-5.5",
    "output": [
      {
        "type": "type",
        "id": "id",
        "status": "status",
        "role": "user",
        "content": "你好，请介绍一下你自己"
      }
    ],
    "usage": {
      "prompt_tokens": 1,
      "completion_tokens": 1,
      "total_tokens": 1,
      "prompt_tokens_details": {
        "cached_tokens": 1,
        "text_tokens": 1,
        "audio_tokens": 1,
        "image_tokens": 1
      },
      "completion_tokens_details": {
        "text_tokens": 1,
        "audio_tokens": 1,
        "reasoning_tokens": 1
      }
    }
  }
  ```
</ResponseExample>

## Authorizations

<ParamField header="Authorization" type="string" required>
  所有接口均需要使用 Bearer Token 进行认证。

  在请求头中添加：

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Body

<ParamField body="model" type="string" required default="gpt-5.5">
  示例：`gpt-5.5`
</ParamField>

<ParamField body="input" type="string or array<object>">
  输入内容，可以是字符串或消息数组
</ParamField>

<ParamField body="instructions" type="string" />

<ParamField body="max_output_tokens" type="integer" />

<ParamField body="temperature" type="number" />

<ParamField body="top_p" type="number" />

<ParamField body="stream" type="boolean" />

<ParamField body="tools" type="array<object>" />

<ParamField body="tool_choice" type="string or object" />

<ParamField body="reasoning" type="object">
  <ParamField body="reasoning.effort" type="string">
    可选值：`low`、`medium`、`high`
  </ParamField>

  <ParamField body="reasoning.summary" type="string" />
</ParamField>

<ParamField body="previous_response_id" type="string" />

<ParamField body="truncation" type="string">
  可选值：`auto`、`disabled`
</ParamField>

## Response

<ResponseField name="id" type="string" />

<ResponseField name="object" type="string">
  示例：`response`
</ResponseField>

<ResponseField name="created_at" type="integer" />

<ResponseField name="status" type="string">
  可选值：`completed`、`failed`、`in_progress`、`incomplete`
</ResponseField>

<ResponseField name="model" type="string" default="gpt-5.5">
  示例：`gpt-5.5`
</ResponseField>

<ResponseField name="output" type="array<object>">
  <ResponseField name="output.type" type="string" />

  <ResponseField name="output.id" type="string" />

  <ResponseField name="output.status" type="string" />

  <ResponseField name="output.role" type="string" />

  <ResponseField name="output.content" type="array<object>">
    <ResponseField name="output.content.type" type="string" />

    <ResponseField name="output.content.text" type="string" />
  </ResponseField>
</ResponseField>

<ResponseField name="usage" type="object">
  <ResponseField name="usage.prompt_tokens" type="integer">
    提示词 Token 数
  </ResponseField>

  <ResponseField name="usage.completion_tokens" type="integer">
    补全 Token 数
  </ResponseField>

  <ResponseField name="usage.total_tokens" type="integer">
    总 Token 数
  </ResponseField>

  <ResponseField name="usage.prompt_tokens_details" type="object">
    <ResponseField name="usage.prompt_tokens_details.cached_tokens" type="integer" />

    <ResponseField name="usage.prompt_tokens_details.text_tokens" type="integer" />

    <ResponseField name="usage.prompt_tokens_details.audio_tokens" type="integer" />

    <ResponseField name="usage.prompt_tokens_details.image_tokens" type="integer" />
  </ResponseField>

  <ResponseField name="usage.completion_tokens_details" type="object">
    <ResponseField name="usage.completion_tokens_details.text_tokens" type="integer" />

    <ResponseField name="usage.completion_tokens_details.audio_tokens" type="integer" />

    <ResponseField name="usage.completion_tokens_details.reasoning_tokens" type="integer" />
  </ResponseField>
</ResponseField>
