✓ Command copied to clipboard! Run it in your terminal.
Open Source · Apache 2.0 · v0.1.0-alpha

The Cognitive Router
for Enterprise AI

A self-hosted, OpenAI-compatible gateway in front of every model your applications use. They hold one CogniGate key; your provider credentials stay in the deployment. Capability aliases, fallback chains, circuit breakers, per-tenant quotas and durable usage metering — built on Go 1.26 and Java 25 LTS.

$curl -sSL https://cognigate.vkrishna04.me/install.sh | bash
❐

Docker and Docker Compose v2 are the only prerequisites. The script generates credentials, starts three containers, and verifies them.

Read the Docs →View on GitHub
14
Conformance-Tested Requirements
0
Provider Keys Written to Disk
3
Containers to Run
Apache-2.0
Licence, No Paid Tier

Everything You Need for Enterprise AI

⚡

Aliases That Do Not Go Stale

fast, balanced and best are constraints, not pins — capability, context window and price, re-resolved against the live catalogue. A chain hardcoded to last year's model decays; a constraint does not.

🔄

Circuit Breaker & Failover

Ordered fallback chains, key rotation inside a provider on a 429, and a breaker scoped to one tenant, provider and model — so an outage costs one timeout rather than every caller's.

🔐

Provider Keys Never Leave

Your application holds a cg- key. The upstream credential is returned by no route, written to no disk, and printed in no log line.

🏢

True Multi-Tenancy

Per-tenant providers, aliases, routing rules, quotas, rate limits and usage — with the admin plane separated from the data plane by the key itself, not by the address.

🔌

OpenAI, Gemini, Claude and the rest

Register a key. Gemini and Claude need nothing else: their endpoints are built in. One adapter covers OpenAI, Together, Groq, Fireworks, OpenRouter, Azure OpenAI, vLLM, Ollama and LM Studio. Pool several keys and they rotate.

💰

Usage You Can Bill From

Every served request metered to PostgreSQL — tokens, cost, provider, model, fallback depth — buffered through an analytics outage and idempotent on retry.

Polyglot Design for Maximum Performance

Two processes, one job each. The gateway is Go 1.26 on Fiber: it authenticates, routes, meters and relays, holding its own configuration in memory so the request path never waits on a database. The analytics engine is Java 25 on Spring Boot 4.1 with virtual threads, and owns the one thing a restart must not lose — usage.

Go 1.26 + Fiber v2
Gateway — :8080
Java 25 LTS + Spring Boot 4.1
Analytics Engine — :8081
PostgreSQL 16
Durable Usage Store

curl -X POST http://localhost:8080 /v1/chat/completions \
-H 'Authorization: Bearer cg-abc123' \
-d '{
"model": "gpt-4",
"messages": [{
"role": "user",
"content": "Hello, CogniGate!"
}]
}'

# CogniGate transparently routes to
# your configured provider, rotates keys,
# tracks usage, and records telemetry

Up and Running in One Command

Prerequisites: Docker and Docker Compose. No Java or Go installation needed.

01

Install & Start

# Linux/macOS:
curl -sSL https://cognigate.vkrishna04.me/install.sh | bash

# Windows PowerShell:
irm https://cognigate.vkrishna04.me/install.ps1 | iex
02

Create a Tenant

# CG_ADMIN is GATEWAY_BOOTSTRAP_KEY from the generated .env
curl -X POST http://localhost:8080/admin/v1/tenants \
  -H "Authorization: Bearer $CG_ADMIN" \
  -H "Content-Type: application/json" \
  -d '{"name":"my-org"}'
# → {"id":"ten_9f2c41ab77d0","name":"my-org","status":"active",...}
03

Mint a Key, Register a Provider

# the cg- key your application will hold
curl -X POST http://localhost:8080/admin/v1/tenants/ten_9f2c41ab77d0/keys \
  -H "Authorization: Bearer $CG_ADMIN" \
  -H "Content-Type: application/json" \
  -d '{"name":"laptop"}'

# the provider credential, which stays in the deployment
curl -X POST http://localhost:8080/admin/v1/tenants/ten_9f2c41ab77d0/providers \
  -H "Authorization: Bearer $CG_ADMIN" \
  -H "Content-Type: application/json" \
  -d '{"name":"openai","base_url":"https://api.openai.com/v1","keys":["sk-..."]}'
04

Start Routing AI Traffic

curl -X POST http://localhost:8080/v1/chat/completions \
  -H "Authorization: Bearer $CG_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"fast","messages":[{"role":"user","content":"Hello!"}]}'
# fast is an alias: X-CogniGate-Served-By says what it resolved to