v1

latestOpenAPI 3.1.02026-08-04134182237.9 KB
Compression

Compress Query Specific

Compress single context with question-aware filtering.

For multiple context+query pairs, use the /batch endpoint.

post/api/compress/question-specific/

Headers

X-API-Keystring required

Request body

contextstring nullable

Context text to compress (single string). If null or empty, the endpoint returns an empty compressed_context with zero tokens and no billing — no error is raised.

compression_model_namestring required

Compression model to use (e.g., 'latte_v1')

querystring required

Query for context-aware filtering (REQUIRED)

target_compression_rationumber nullable

Target ratio: 0-1 (strength) or >1 for factor (e.g., 2=2x). Max 200.

coarseboolean

Use coarse-grained compression (paragraph-level). Default: True.

heuristic_chunkingboolean

Use heuristic chunking for better structure preservation. Default: False.

disable_placeholdersboolean

Disable placeholder tokens in compressed output. Default: False.

dynamicboolean

latte_v2 only. Use Kneedle elbow selection instead of a fixed ratio; overrides target_compression_ratio when True.

dynamic_min_rationumber nullable

latte_v2 only. Floor on compression when dynamic=True.

dynamic_max_rationumber nullable

latte_v2 only. Ceiling on compression when dynamic=True.

source'demo' | 'extension' | 'sdk:python' | 'sdk:typescript' | 'sdk:curl' | 'gateway:unknown' | 'gateway:anthropic' | 'gateway:openai' | 'gateway:gemini' | 'integration:litellm' | 'integration:hermes'

Source of an API request.

Format: source[:detail]

  • demo, extension: no detail needed
  • sdk:python, sdk:typescript, sdk:curl
  • gateway:anthropic, gateway:openai, gateway:gemini
  • integration:litellm, integration:hermes

Response

Successful Response

successboolean
messagestring nullable