4Z API

gpt context compression

Endpoint: POST https://4zapi.com/v1/responses/compact

Compress GPT chat context to reduce tokens for later requests.

Request body (application/json)

  • input (array<object>, required): List of historical messages that need to be compressed
  • model (string, required): Model name, such as gpt-5.6-sol

Request example

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