# Zero-Cost Edge Semantic Vector Cache API [API-05]
> Sub-5ms edge vector cache intercepting recurring LLM queries across 330+ Anycast points of presence. Reduce repetitive inference bills to $0.00.

## Specifications
- Canonical Documentation: https://topaigateway.com/api/semantic-cache
- Production Endpoint: https://topaigateway.com/v1/api/05-semantic-cache
- Method: POST
- Category: FinOps & Token Optimization
- Subscription Pack: Pack 1 - DevEx & FinOps (14 € / month (10,000 req included))
- Latency Target: < 5 ms
- Free Tier: 100 free requests/month (no credit card required)

## Quickstart (cURL)
```bash
curl -X POST https://topaigateway.com/v1/api/05-semantic-cache \
  -H "Content-Type: application/json" \
  -d '{"query": "What is the capital of France?", "threshold": 0.92}'
```

## Sample Request
```json
{
  "query": "What is the capital of France?",
  "threshold": 0.92
}
```

## Sample Response
```json
{
  "success": true,
  "api": "[API-05] Semantic Vector Cache",
  "cache_hit": true,
  "similarity_score": 0.984,
  "cached_response": "The capital of France is Paris.",
  "latency_ms": 3.2
}
```

## SDK Code Samples
### TypeScript / Node.js
```typescript
const res = await fetch("https://topaigateway.com/v1/api/05-semantic-cache", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ query: "What is the capital of France?", threshold: 0.92 })
});
const data = await res.json();
console.log(data);
```

### Python
```python
import requests

resp = requests.post(
    "https://topaigateway.com/v1/api/05-semantic-cache",
    json={"query": "What is the capital of France?", "threshold": 0.92}
)
print(resp.json())
```

## Performance Benchmarks
- Edge Latency: 3.2 ms
- Similarity Engine: Vector Cosine
- Global PoPs: 330+ Anycast
- Token Cost on Hit: $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
