Skip to main content
POST
/
api
/
v1
/
llm
/
responses
/
compact
Typescript (SDK)
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.responses.compact({
    model: "meetkai:functionary-urdu-mini-pak",
    previousResponseId: "resp_abc123",
  });

  console.log(result);
}

run();
{
  "id": "<string>",
  "created_at": 0,
  "object": "<unknown>",
  "output": [
    {
      "role": "user",
      "content": "<string>",
      "type": "<unknown>",
      "status": "in_progress",
      "id": "msg_aa87e2b1112a455b8deabed784372198"
    }
  ],
  "usage": {
    "input_tokens": 4503599627370495,
    "input_tokens_details": {
      "cached_tokens": 4503599627370495
    },
    "output_tokens": 4503599627370495,
    "output_tokens_details": {
      "reasoning_tokens": 4503599627370495
    },
    "total_tokens": 4503599627370495
  }
}

Authorizations

Authorization
string
header
required

Gateway auth: send Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, you can also send X-On-Behalf-Of: <external-user-id>.

Body

application/json

Request schema for compacting a response's conversation history into a condensed summary.

model
string
required

The model to use for generating the compaction summary.

input

Text, image, or file inputs to the model, used to generate a response.

instructions
string

A system (or developer) message inserted into the model's context. When used 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

The ID of a previous response whose conversation history should be compacted. If omitted, only the provided input is compacted.

Response

200 - application/json

The compacted response object containing user messages and compaction summary.

id
string
required
created_at
integer
required
Required range: -9007199254740991 <= x <= 9007199254740991
object
any
required
output
(Input message item · object | Output message item · object | File search call item · object | Computer call item · object | Computer call output item · object | Web search call item · object | Function call item · object | Function call output item · object | Reasoning item · object | Image generation call item · object | Code interpreter call item · object | Local shell call item · object | Local shell call output item · object | MCP list tools item · object | MCP approval request item · object | MCP approval response item · object | MCP call item · object | Custom tool call item · object | Custom tool call output item · object | Item reference item · object | Compaction item · object)[]
required

Input message item: A message with role and content. Use this for user, assistant, system, or developer turns in structured inputs.

usage
object
required