Compression control

Custom rules

Extend smart detection with your own regex rules. Useful for organization-specific keywords, product names that shouldn't be abbreviated, or domains where you always want a specific intensity.

Rule types

  • never_compress — if the user prompt matches this regex, intensity becomes none and mintoken is bypassed.
  • always_compress — if the prompt matches, intensity is forced to ultra.
  • keep_exact — words that must be preserved verbatim in the model's output (not yet implemented as a classifier — this is for the planned vocabulary feature).
  • abbreviation — custom replacement suggestions (planned).

Creating rules

# Force "ultra" intensity on any prompt mentioning internal logs
curl -X POST https://api.mintoken.in/v1/rules \
  -H "Authorization: Bearer <supabase-jwt>" \
  -H "Content-Type: application/json" \
  -d '{
    "rule_type": "always_compress",
    "pattern": "internal log|service log",
    "priority": 10
  }'

# Never compress anything mentioning "invoice"
curl -X POST https://api.mintoken.in/v1/rules \
  -H "Authorization: Bearer <supabase-jwt>" \
  -H "Content-Type: application/json" \
  -d '{
    "rule_type": "never_compress",
    "pattern": "invoice",
    "priority": 20
  }'

Priority

Higher priority wins. If a prompt matches both a never_compress rule and an always_compress rule, the one with the higher priority number is applied. Ties break in favor of never_compress.

Listing and deleting

GET /v1/rules returns all rules for your account. DELETE /v1/rules/{id} removes one.