# TokenSlimmer Dynamic AI Context Compressor API [API-09]
> Prune redundant syntax, boilerplate whitespace, and low-entropy tokens from LLM prompts in sub-15ms with 100% semantic fidelity.

## Specifications
- Canonical Documentation: https://topaigateway.com/api/tokenslimmer
- Production Endpoint: https://topaigateway.com/v1/api/09-tokenslimmer
- Method: POST
- Category: FinOps & Token Optimization
- Pack / License: Pack 1 - DevEx & FinOps ($14 / month (10,000 req included))
- Latency Target: < 15 ms
- Free Tier: 100 free requests/month (no credit card required)
- Direct Checkout: https://topaigateway.com/checkout?pack=pack_1_devex&direct=true&utm_source=gsc_pseo&utm_medium=organic&utm_campaign=tokenslimmer

## What's Included Inside Your Instant Download
- Instant live API key (topai_live_*) for POST /v1/api/09-tokenslimmer, /v1/auto & /v1/slim/json (10,000 req/mo)
- 7-Day $0 Free Trial on Pack 1 DevEx with 1-click Polar cancellation and zero token markup
- Drop-in OpenAI/Anthropic reverse proxy intercepting bloated HTML, JSON & Markdown before upstream billing
- Full Pack 1 FinOps bundle (101 edge micro-APIs) + shadow FinOps savings diff auditor (/v1/audit/savings-diff)

## Buyer Protection Guarantee
- 14-Day 100% No-Questions-Asked Money-Back Guarantee · Instant ZIP + API Key Delivery · Zero Recurring Fees on Toolkits

## Quickstart (cURL)
```bash
curl -X POST https://topaigateway.com/v1/api/09-tokenslimmer \
  -H "Content-Type: application/json" \
  -d '{"payload": "Your extensive prompt or JSON context goes here..."}'
```

## Sample Request
```json
{
  "payload": "Please review this JSON configuration carefully and ensure that all attributes adhere to standard guidelines.   {   \"status\": \"active\",   \"version\": \"1.0\",   \"debug\": false   }"
}
```

## Sample Response
```json
{
  "success": true,
  "api": "[API-09] TokenSlimmer AST Optimizer",
  "status": "COMPRESSED",
  "reduction_percent": "48.2%",
  "tokens_saved": 38,
  "latency_ms": 4.8
}
```

## SDK Code Samples
### TypeScript / Node.js
```typescript
const res = await fetch("https://topaigateway.com/v1/api/09-tokenslimmer", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ payload: "Your extensive prompt or JSON context goes here..." })
});
const data = await res.json();
console.log(data.compressed_content);
```

### Python
```python
import requests

resp = requests.post(
    "https://topaigateway.com/v1/api/09-tokenslimmer",
    json={"payload": "Your extensive prompt or JSON context goes here..."}
)
print(resp.json()["compressed_content"])
```

## Performance Benchmarks
- Latency: 4.8 ms
- Token Reduction: 30% – 68%
- Semantic Retention: 100%
- Token Markup: $0.00

## Compliance & Governance
- European Union DORA (UE) 2022/2554 Article 30 Compliant
- Zero-Retention & Zero-PII Policy: Prompts are executed on memory-only V8 isolates
- 1-Click Upgrade Portal: https://topaigateway.com/#pricing
