API reference
POST /compress/markdown
Structure-aware compression for markdown input. Preserves headings, lists, and code fences.
POST
/api/compress/markdown/API keyStructure-aware compression for markdown input. Preserves headings, lists, and code fences.
REST-only endpoint, not exposed in the Python or TypeScript SDKs. Call it directly over HTTP when you need structural compression of markdown documents.
Keeps headings, list bullets, and code fences intact while shortening prose. Unlike /compress/question-specific/, this endpoint does not take a query; it's structural, not query-conditioned.
Request body
contextstringRequiredThe markdown text to compress. Pass null or an empty string to get an empty result with no billing.
compression_model_namestringRequiredCompression model name. Use the markdown model exposed for your account.
target_compression_rationumberOptionalDefault:
model defaultCompression strength. See /docs/api-reference/models.
Response
Response
successbooleantrue on success.
dataobjectoriginal_contextstringThe input markdown, echoed back.
compressed_contextstringThe compressed markdown, with headings and structural elements preserved.
original_tokensintegercompressed_tokensintegertokens_savedintegertarget_compression_rationumber | nullactual_compression_rationumberduration_msinteger
Status codes
Status codes
200Compression succeeded.OK400Malformed JSON body.Bad Request401Missing or invalidUnauthorizedX-API-Key.422Field validation failure.Unprocessable Entity429Rate limit hit.Too Many Requests500Upstream error.Internal Server Error503Upstream error.Service Unavailable
Request
python
Response
json