# 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
- Pack / License: Pack 1 - DevEx & FinOps ($14 / month (10,000 req included))
- Latency Target: < 5 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=semantic-cache

## What's Included Inside Your Instant Download
- Production POST /v1/api/05-semantic-cache & /v1/cache/semantic edge endpoints (10,000 req/mo quota)
- Instant on-screen API key (topai_live_*) deployed across 330+ Anycast PoPs with $0.00 token markup on hits
- Bundled with all 101 Pack 1 FinOps micro-APIs including TokenSlimmer (API-09) and Web-to-Markdown (API-01)
- Ready-to-run TypeScript, Python & LangChain cache snippets + cookieless edge telemetry portal

## 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/05-semantic-cache \
  -H "Content-Type: application/json" \
  -d '{"action": "get", "query": "What is the capital of France?", "threshold": 0.92}'
```

## Sample Request
```json
{
  "action": "get",
  "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({ action: "get", 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={"action": "get", "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
