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

# Responses 模型响应与思考

> 高级模型思考链路、函数调用与响应上下文压缩

## gpt 上下文压缩

`POST /v1/responses/compact`

压缩 GPT 对话上下文，减少后续请求的 token 占用。

### 请求体参数 (Body)

<ParamField body="input" type="array" required>
  需要压缩的历史消息列表
</ParamField>

<ParamField body="model" type="string" required>
  模型名称，例如 gpt-5-codex
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "input": [
    {
      "content": "Hello, this is a compact test.",
      "role": "user",
      "type": "message"
    }
  ],
  "model": "gpt-5.4"
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1/responses/compact" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": [
    {
      "content": "Hello, this is a compact test.",
      "role": "user",
      "type": "message"
    }
  ],
  "model": "gpt-5.4"
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "created_at": 1779183068,
  "id": "resp_010f1725ac1c2947016a0c2ddb9dcc81989aff546cbc9f7eb2",
  "object": "response.compaction",
  "output": [
    {
      "content": [
        {
          "text": "你好，请用一句话回复。",
          "type": "input_text"
        }
      ],
      "id": "msg_010f1725ac1c2947016a0c2ddbbd38819883f6c1d69c625183",
      "role": "user",
      "status": "completed",
      "type": "message"
    },
    {
      "encrypted_content": "gAAAAABqDC3c-W14MVMVz_8_5eeXDk1S-t1_rDOciRXR4HpuZXluWNcLMVLzW57ojCF4tl0-K5GdbKqIAQ1cBfr7FOY52gylXqqUE9uHbI3Pimil5CA0fhVGtiKZ_Me_VDUw8d_YU43C0qRBV4tzTeHszRVwNiod8v0HuqFE5B7XeDPtYcer_RIRO2qLbK0NvDlcx1LtiuHDyAjOKan3V-prukIJDx1-9oNTJmj6LX9aodXhHiltA1j49ufZuk7NsEzDkK0u588HDhraI0PCU-bY0Rpih7Yd2nE_XEnEfLpsYBzgyt1YoTObsOb1AIU0tBQ8OMw101dMXnv6EQ_xwp6mE1o7oHcho7AK86_MBZS4GehUef9nMZMJsQGGaGdjkC5eKED5XWVMAlQ5A5LlPrx3Ne3bScLUvQRNPZocAGrWbHUqGoGHoee6LkPhqpAkyV2JecvLynXR4kMhCQOaktUDbIC2Uszm2qkfWBkACH8yV_btuSPZhhk5KxrmCgi55JAA6esv1PK3kRrpj6Am6RkmqQH017koqsrUu62S8dtUlWn3hZY7kTSX9ISvL1gkoue05QPgM0TSeSLAPSax2MpqJUEajPQv0ktFKGZP88npcXYarb20Nw7k2IfchS79cQ90Y7-BLPLKErHHnssNUzdVgiCjzoCCQsSn28d52DGvtOJqfQ_JyHPBma8yKDpkRpLJggScKfyEpA-v6iTbRnQUY8TV29V37tZAKrMZ6p8dRWHYI0cehnfdqr0VPRFr-Z0FkX1rHM-0CKx-WyHQQ8_kdxh5WyaQq1a-J8R1SDQFMtU89wB6bdCBavi27GE63dKYfG6oJyetzNtnlJLBXkjAjTusSKCYdA==",
      "id": "cmp_010f1725ac1c2947016a0c2ddc48588198b65e0e0816f998a6",
      "type": "compaction_summary"
    }
  ],
  "usage": {
    "input_tokens": 31,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 34,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 65
  }
}
```

***

## 创建函数调用 Copy

`POST /v1/responses`

[https://platform.openai.com/docs/api-reference/responses/create](https://platform.openai.com/docs/api-reference/responses/create)
部分OpenAI模型仅支持Response格式，例如o3-pro，codex-mini-latest

### 请求参数 (Query / Path)

<ParamField header="Content-Type" type="string" required>
  请求体 Content-Type，一般为 application/json
</ParamField>

<ParamField header="Accept" type="string" required>
  期望的响应 Content-Type
</ParamField>

<ParamField header="Authorization" type="string">
  Bearer API Key
</ParamField>

### 请求体参数 (Body)

<ParamField body="input" type="array">
  输入内容
</ParamField>

<ParamField body="model" type="string">
  要使用的模型的 ID。有关哪些模型可与聊天 API 一起使用的详细信息,请参阅模型端点兼容性表。
</ParamField>

### 请求示例 (JSON)

```json theme={null}
{
  "input": [
    {
      "content": "请同时帮我做以下几件事：\n1. 获取当前系统时间\n2. 查看系统信息（操作系统、内存等）\n3. 帮我计算 123.5 + 456.7 的结果\n4. 生成3个1-100之间的随机数\n\n这是一个并行工具调用测试，请同时执行这些任务。",
      "role": "user"
    }
  ],
  "metadata": {
    "model_id": "32"
  },
  "model": "gpt-4.1",
  "tool_choice": "auto",
  "tools": [
    {
      "description": "生成指定范围内的随机数，支持批量生成",
      "name": "random_generator",
      "parameters": {
        "properties": {
          "count": {
            "description": "生成数量（默认1，最大10）",
            "type": "integer",
            "x-i18n": {
              "en-US": {
                "description": "Number of generations (default 1, maximum 10)"
              }
            }
          },
          "max": {
            "description": "最大值（默认100）",
            "type": "integer",
            "x-i18n": {
              "en-US": {
                "description": "Maximum value (default 100)"
              }
            }
          },
          "min": {
            "description": "最小值（默认1）",
            "type": "integer",
            "x-i18n": {
              "en-US": {
                "description": "Minimum value (default 1)"
              }
            }
          }
        },
        "type": "object"
      },
      "type": "function",
      "x-i18n": {
        "en-US": {
          "description": "Generate random numbers within a specified range, supporting batch generation"
        }
      }
    },
    {
      "description": "获取当前系统的基本信息，包括操作系统、Java版本、内存使用情况等",
      "name": "system_info",
      "parameters": {
        "properties": {},
        "type": "object"
      },
      "type": "function",
      "x-i18n": {
        "en-US": {
          "description": "Obtain basic information about the current system, including operating system, Java version, memory usage, etc."
        }
      }
    },
    {
      "description": "执行基本数学运算，支持加减乘除和幂运算",
      "name": "math_calculator",
      "parameters": {
        "properties": {
          "a": {
            "description": "第一个数字",
            "type": "number",
            "x-i18n": {
              "en-US": {
                "description": "first number"
              }
            }
          },
          "b": {
            "description": "第二个数字",
            "type": "number",
            "x-i18n": {
              "en-US": {
                "description": "second number"
              }
            }
          },
          "operation": {
            "description": "运算类型: add, subtract, multiply, divide, power",
            "type": "string",
            "x-i18n": {
              "en-US": {
                "description": "Operation types: add, subtract, multiply, divide, power"
              }
            }
          }
        },
        "required": [
          "operation",
          "a",
          "b"
        ],
        "type": "object"
      },
      "type": "function",
      "x-i18n": {
        "en-US": {
          "description": "Perform basic mathematical operations, supporting addition, subtraction, multiplication, division and exponentiation operations"
        }
      }
    },
    {
      "description": "获取当前系统时间",
      "name": "current_time",
      "parameters": {
        "properties": {},
        "type": "object"
      },
      "type": "function",
      "x-i18n": {
        "en-US": {
          "description": "Get the current system time"
        }
      }
    }
  ]
}
```

### 请求示例 (cURL)

```bash theme={null}
curl -X POST "https://socialvision.tisyk.xyz/v1/responses" \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": [
    {
      "content": "请同时帮我做以下几件事：\n1. 获取当前系统时间\n2. 查看系统信息（操作系统、内存等）\n3. 帮我计算 123.5 + 456.7 的结果\n4. 生成3个1-100之间的随机数\n\n这是一个并行工具调用测试，请同时执行这些任务。",
      "role": "user"
    }
  ],
  "metadata": {
    "model_id": "32"
  },
  "model": "gpt-4.1",
  "tool_choice": "auto",
  "tools": [
    {
      "description": "生成指定范围内的随机数，支持批量生成",
      "name": "random_generator",
      "parameters": {
        "properties": {
          "count": {
            "description": "生成数量（默认1，最大10）",
            "type": "integer",
            "x-i18n": {
              "en-US": {
                "description": "Number of generations (default 1, maximum 10)"
              }
            }
          },
          "max": {
            "description": "最大值（默认100）",
            "type": "integer",
            "x-i18n": {
              "en-US": {
                "description": "Maximum value (default 100)"
              }
            }
          },
          "min": {
            "description": "最小值（默认1）",
            "type": "integer",
            "x-i18n": {
              "en-US": {
                "description": "Minimum value (default 1)"
              }
            }
          }
        },
        "type": "object"
      },
      "type": "function",
      "x-i18n": {
        "en-US": {
          "description": "Generate random numbers within a specified range, supporting batch generation"
        }
      }
    },
    {
      "description": "获取当前系统的基本信息，包括操作系统、Java版本、内存使用情况等",
      "name": "system_info",
      "parameters": {
        "properties": {},
        "type": "object"
      },
      "type": "function",
      "x-i18n": {
        "en-US": {
          "description": "Obtain basic information about the current system, including operating system, Java version, memory usage, etc."
        }
      }
    },
    {
      "description": "执行基本数学运算，支持加减乘除和幂运算",
      "name": "math_calculator",
      "parameters": {
        "properties": {
          "a": {
            "description": "第一个数字",
            "type": "number",
            "x-i18n": {
              "en-US": {
                "description": "first number"
              }
            }
          },
          "b": {
            "description": "第二个数字",
            "type": "number",
            "x-i18n": {
              "en-US": {
                "description": "second number"
              }
            }
          },
          "operation": {
            "description": "运算类型: add, subtract, multiply, divide, power",
            "type": "string",
            "x-i18n": {
              "en-US": {
                "description": "Operation types: add, subtract, multiply, divide, power"
              }
            }
          }
        },
        "required": [
          "operation",
          "a",
          "b"
        ],
        "type": "object"
      },
      "type": "function",
      "x-i18n": {
        "en-US": {
          "description": "Perform basic mathematical operations, supporting addition, subtraction, multiplication, division and exponentiation operations"
        }
      }
    },
    {
      "description": "获取当前系统时间",
      "name": "current_time",
      "parameters": {
        "properties": {},
        "type": "object"
      },
      "type": "function",
      "x-i18n": {
        "en-US": {
          "description": "Get the current system time"
        }
      }
    }
  ]
}'
```

### 响应示例 (200 OK)

```json theme={null}
{
  "background": false,
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "Function call completed",
        "role": "assistant"
      }
    }
  ],
  "created": 1756108120,
  "created_at": 1756108120,
  "id": "resp_68ac1558e9488190bcc2cbb94c7d7a140b8064b15a091a77",
  "metadata": {},
  "model": "gpt-4.1-data",
  "object": "response",
  "output": [
    {
      "arguments": "{\"sign\":\"Aquarius\"}",
      "call_id": "call_6kbB2GTk62PPUNdGuBJPx9KQ",
      "id": "fc_68ac15594be88190a58217f75a6a54cc0b8064b15a091a77",
      "name": "get_horoscope",
      "status": "completed",
      "type": "function_call"
    }
  ],
  "parallel_tool_calls": true,
  "service_tier": "default",
  "status": "completed",
  "store": true,
  "temperature": 1,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [
    {
      "description": "Get today's horoscope for an astrological sign.",
      "name": "get_horoscope",
      "parameters": {
        "properties": {
          "sign": {
            "description": "An astrological sign like Taurus or Aquarius",
            "type": "string"
          }
        },
        "required": [
          "sign"
        ],
        "type": "object"
      },
      "strict": true,
      "type": "function"
    }
  ],
  "top_p": 1,
  "truncation": "disabled",
  "usage": {
    "completion_tokens": 18,
    "input_tokens": 62,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 18,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "prompt_tokens": 62,
    "total_tokens": 80
  }
}
```

***


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