# 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
- Subscription Pack: Pack 1 - DevEx & FinOps (14 € / month (10,000 req included))
- Latency Target: < 15 ms
- Free Tier: 100 free requests/month (no credit card required)

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

## Sample Request
```json
{
  "prompt": "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({ prompt: "Your extensive prompt 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={"prompt": "Your extensive prompt 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
