---
title: "Compact a conversation"
method: POST
path: "/responses/compact"
tags: ["Responses"]
---

# Compact a conversation

`POST /responses/compact`

## Request

- Base URL: `https://api.openscale.so/v1`
- URL: `https://api.openscale.so/v1/responses/compact`
- Auth: HTTP bearer

Summarize a conversation so it can continue in fewer tokens. Takes `model` and the conversation as `input` (and/or `previous_response_id`, plus `instructions`). The output keeps your user messages and ends with a `compaction` item that stands for everything else; send the output, followed by new items, as the next input. Nothing is stored. Billed like a response.

## Request body

- object
  - `model` string, required
  - `input` unknown
  - `previous_response_id` string
  - `instructions` string

## Response `200`

The compacted conversation.

- object
  - `id` string, required
  - `object` 'response.compaction', required
  - `created_at` integer, required
  - `output` object[], required
  - `usage` object, required

## Other responses

- `400`: The request cannot be served; `param` names the field.
- `401`: Missing or invalid API key.

---

[API](https://skmtc.dev/openscale/apis/openscale-api.md) - [All operations](https://skmtc.dev/openscale/apis/openscale-api/llms.txt) - [OpenAPI document](https://skmtc.dev/openscale/apis/openscale-api/revisions/587e72b44932?raw)
