Semantic Gateway
Neural Context Engine · Groq Llama 3.1 & 3.3 · Vector Cache

Cut Your LLM API Costs
by ~65% Safely.

Query-aware neural compression for chat, RAG, and coding agents. Drops low-value filler before inference while locking answer-critical evidence (>98% target, 99.4% recall).

Try Interactive Sandbox
semantic-gateway — 127.0.0.1:8000
# Start Semantic Gateway
$ uvicorn main:app --host 0.0.0.0 --port 8000 --reload

✓ Initialized Neural Compression Engine (Compiler & Precision)
✓ FastEmbed 384-dim Dense Vector Cache Ready
✓ Complexity Router (Groq 8B & 70B) Active
Listening on http://127.0.0.1:8000 ▋
~58–66%
Mean Token Cut
Dynamic compression eliminates low-value filler across long dumps.
99.4%
Critical Kept
Target >98% oracle retention. Pooled gold containment 99.4%.
<50ms
Query-Aware CPU Speed
Dense neural ranking runs on CPU without extra LLM summarizer calls.
$0.00
Semantic Cache Hits
Vector cosine matching serves identical semantic intent instantly.
LLM Context Compression Benchmarks

Same budget. Who keeps the answer?

Fair test: every method keeps only 35% of prompt tokens. The critical metric is oracle recall — whether answer-bearing evidence survives compression.

Method Answer-Critical Recall Mean Token Cut Extra Model Calls Latency (CPU) Quality Gate
Semantic LLM (Compiler Mode) 100.0% Oracle Recall 65.2% Cut $0 (Zero Calls) ~42ms Passed (≥98%)
H2O Heavy Hitter 97.9% 65.0% Cut $0 (Zero Calls) ~120ms Passed
LLM Summarization Call 60.5% 65.0% Cut +1 Full LLM Call ($$$) ~1,850ms High Cost & Lag
Truncation / FIFO Rolling Window 24.8% (Answers Lost) 65.0% Cut $0 (Zero Calls) ~2ms Failed Gate
1. Select Preset & Input Context 0 chars · ~0 tokens
Mode:
LIVE INFERENCE IMPACT ACTIVE
  • Total Requests 0
  • Cache Hit Rate 0.0%
  • Tokens Saved 0
  • API Cost Saved $0.00000
  • Avg Direct Miss Latency —
  • Avg Vector Cache Hit —
Total Requests
0
Cache Hit Rate
0.0%
Total Tokens Saved
0
Estimated Cost Saved
$0.00000
Latency Comparison: Direct Upstream Miss vs Vector Cache Hit (ms)
Timestamp Prompt Routing Tier Model Executed Cache Status Tokens (In / Opt) Latency Cost Saved
No queries recorded yet. Send a request in the Sandbox!

Semantic LLM Integration Guide

Drop Semantic Gateway in front of OpenAI, Anthropic, Groq, or local models.

1. Context Compression Endpoint (POST /v1/compress)

curl -X POST http://localhost:8000/v1/compress \ -H "Content-Type: application/json" \ -d '{ "context": "Long context...", "query": "What failed?", "mode": "compiler" }'

2. Python Library SDK

from services.compression import compress_for_turn result = compress_for_turn(context=chat_history, user_query="Explain connection pool timeout") print(result["compressed_text"], result["tokens_saved_pct"])

3. Coding Agent MCP Plugin Setup (Cursor / Windsurf)

# .cursor/mcp.json
{ "mcpServers": { "semantic-gateway": { "command": "npx", "args": ["-y", "@semantic-llm/mcp-proxy", "--port", "8000"] } } }