from mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.llm.responses.compact(model="meetkai:functionary-urdu-mini-pak", previous_response_id="resp_abc123")
# Handle response
print(res){
"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
}
}Creates a compacted summary of the conversation history for a response, reducing context size while preserving key information. Returns a compacted response object.
from mka1 import SDK
with SDK(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:
res = sdk.llm.responses.compact(model="meetkai:functionary-urdu-mini-pak", previous_response_id="resp_abc123")
# Handle response
print(res){
"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
}
}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>.
Optional external end-user identifier forwarded by the API gateway.
Request schema for compacting a response's conversation history into a condensed summary.
The model to use for generating the compaction summary.
Text, image, or file inputs to the model, used to generate a response.
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.
The ID of a previous response whose conversation history should be compacted. If omitted, only the provided input is compacted.
The compacted response object containing user messages and compaction summary.
-9007199254740991 <= x <= 9007199254740991Input message item: A message with role and content. Use this for user, assistant, system, or developer turns in structured inputs.
Show child attributes
Show child attributes
Was this page helpful?