Trim one payload to what a query needs (trim-1)

Compression of one payload: trim-1 keeps the lines of input the query needs, verbatim, and leaves out the rest under markers. Not compaction: it never reads a conversation. The answer is the output and token counts only. Metered per call and per token against the organization's monthly trim allowance.

post/v1/trim

Request

  • Base URL
    https://gateway.caveman.so
  • URL
    https://gateway.caveman.so/v1/trim
  • Auth
    API key in header x-cave-api-key

Headers

x-cave-retention'metadata' | 'zdr'

metadata or zdr narrows the project's retention for this call: the model runs in memory, nothing is stored and no recovery handle is returned. A call never widens the project's retention.

Request body

inputstring required

One payload: a tool output, file, log or document. The body is at most 2 MB.

querystring required

What the payload is read for: the ask, the agent's intent, the call that produced it. Must not be blank.

level'conservative' | 'balanced' | 'aggressive'

How much trim-1 keeps: conservative keeps most.

Response

The trimmed payload

outputstring required

The lines of input the query needs, verbatim and in order, with a marker for each run left out; the input itself when trimming would not cut enough.

tokens_beforeinteger required
tokens_afterinteger required
recovery_handlestring

Present when something was left out and it was stored: GET /sdk/v1/ccr/{handle} returns the input byte for byte. Absent under metadata or zdr retention, and when the installation has no recovery store or it failed; the output is the same either way.

model'trim-1' required

Changes

No recorded changes to this operation across all 1 revision of this API.