ContextGate is a prompt compression API that automatically compresses and normalizes prompts before they hit your LLM — lowering costs, latency, and context bloat.
It removes redundancy, filters noise, and semantically deduplicates content through a multi-stage pipeline, returning a cleaner, more efficient prompt.
All endpoints are under /api/v1/.
| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST |
/signup |
— | Register a new account |
POST |
/login |
— | |
POST |
/refresh |
— | Exchange refresh token for new access token |
POST |
/logout |
Bearer | |
GET |
/me |
Bearer | Current user |
POST |
/compress/text |
X-API-Key |
Compress plain text |
POST |
/compress/pdf |
X-API-Key |
Upload PDF, compress extracted text |
GET |
/api_keys |
Bearer | List your API keys |
POST |
/api_keys |
Bearer | Create an API key |
DELETE |
/api_keys/{id} |
Bearer | Revoke an API key |
GET |
/admin/customers |
Admin | List all customers and their keys |
DELETE |
/admin/customers/{uid}/api_keys/{kid} |
Admin | Revoke a customer's key |
- Python 3.12+
- Node.js 22+ and Yarn
- PostgreSQL
1. Install dependencies
The backend uses uv as its package manager.
cd backend
uv sync2. Activate env
source .venv/bin/activate3. Configure environment
Copy the example file and fill in your values:
cp .env.example .env4. Download ML models
The semantic deduplication stage requires a local copy of all-MiniLM-L6-v2. Download it once:
uv run python scripts/download_models.py5. Run database migrations
uv run alembic upgrade head6. Create an admin user
uv run python scripts/create_admin.py \
--email admin@example.com \
--password secret \
--first-name Admin \
--last-name User7. Start the server
fastapi devThe API will be available at http://localhost:8000. Interactive docs at http://localhost:8000/docs.
1. Install dependencies
cd frontend
yarn install2. Configure environment
cp .env.local.example .env.local3. Start the dev server
yarn devOpen http://localhost:3000. Log in with the admin account created above, or sign up as a new customer.
