Skip to content

Compact a response

POST https://api.fastapi.ai/v1/responses/compact

Runs a compaction pass over a conversation. Compaction returns encrypted, opaque items and the underlying logic may evolve over time.

Request body


model string Required
Model ID used to generate the response, like gpt-5 or o3. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models.


input string or array Optional
Text, image, or file inputs to the model, used to generate a response.


instructions string Optional
A system (or developer) message inserted into the model's context.
When using along with previous_response_id, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses.


previous_response_id string Optional
The unique ID of the previous response to the model.


max_output_tokens integer Optional
An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.


max_tool_calls integer Optional
The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.


metadata map Optional
Set of 16 key-value pairs that can be attached to an object. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Returns


Returns a compacted Response object.

See the compacted response object in Response objects.

那年我双手插兜, 让bug稳如老狗