Prompt Compression

Shorten a prompt towards a requested reduction while aiming to preserve its meaning. Returns the shorter text and estimated savings.

Pay by wallet (x402) AI-generated prompt-compress

Example

Example answer
{
  "original_tokens": 14,
  "removed_content": [
    "This is a test",
    "for"
  ],
  "compressed_prompt": "Automated capability testing input.",
  "compressed_tokens": 9,
  "preserved_instructions": [
    "Identify this as test input",
    "Recognize it's for automated capability testing"
  ],
  "actual_reduction_percent": 36
}

Inputs

FieldTypeRequiredWhat it is
prompt_textstringYes—
target_reduction_percentintegerNoDefault 30

Output fields

How reliably each field appears in a successful answer.

FieldTypeAppears
original_tokensintegerAlways (present in every successful answer)
compressed_promptstringAlways (present in every successful answer)
compressed_tokensintegerAlways (present in every successful answer)
actual_reduction_percentintegerAlways (present in every successful answer)

How to call it

The same tool through each route. MCP clients reach it through Strale’s server at https://api.strale.io/mcp; the call below is what the agent sends.

# Needs an API key. max_price_cents caps what this call may cost.
curl -X POST https://api.strale.io/v1/do \
  -H "Authorization: Bearer $STRALE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "capability_slug": "prompt-compress",
    "inputs": {
      "prompt_text": "You are a helpful AI assistant. Please help me write a comprehensive function that validates email addresses using a robust regex pattern, handling edge cases like internationalized addresses, plus-sign addressing, and subdomain TLDs."
    },
    "max_price_cents": 3
  }'

Limitations

  • Compression can remove important context

    Compression may remove context that appears redundant but is semantically important for specific AI tasks

    What to do instead: Test compressed prompts against your original to verify output quality is maintained before switching