Local AI Infrastructure

LLM Gateway

A self-hostable control layer for routing AI requests from Open Keyboard and other local tools through managed client keys, model access rules, and operational controls.

Product idea: give AI-powered apps a controlled backend instead of placing provider keys, model choices, and request rules directly inside each client.

Current progress: the gateway can manage client keys, apply usage limits, expose scoped model lists, route OpenAI-compatible chat requests, and test requests through an admin playground.

My role: backend design, TypeScript implementation, admin UI, local deployment workflow, OpenKeyboard integration contract, and verification scripts.

API
Chat
Compatible
OpenAI-style endpoints
Auth
Keys
Client Access
Create, edit, disable, test
Limits
Usage
Rate Limits
Per-key request control
Models
Scoped
Discovery
Per-key model access

Manager Summary

Problem

AI Access Needs A Control Point

Client apps need a safe way to call AI models without hardcoding credentials, exposing every model, or mixing product logic with provider setup.

Solution

Gateway Between Product And Models

The gateway gives each client a managed key, approved models, and usage limits, then forwards compatible requests to configured AI backends.

Value

Better Operational Control

It makes the AI layer easier to test, rotate, limit, and debug without changing the iOS keyboard every time the backend setup changes.

Status

Working Local Infrastructure

The project is ready for local and self-hosted experimentation, with admin workflows, request routing, and tests for the core contracts.

What Works Now

Admin

Client Key Management

The admin UI can create, edit, rotate, disable, and test client keys without changing server configuration files for each client.

Routing

AI Request Routing

The gateway accepts OpenAI-compatible requests, validates the client key, checks model access, and forwards the request to the configured model backend.

Controls

Usage And Model Limits

Each key can have allowed models, default model behavior, and request limits so tools can share the gateway with clearer boundaries.

Testing

Admin Playground

The browser playground can run live request checks for a selected key, including OpenKeyboard-style writing requests.

Gateway Screens

LLM Gateway admin UI showing API key management, models, and rate limits.
Client key managementAdmin view for controlling access, selected models, and per-key limits.
LLM Gateway playground showing a structured writing request and AI response.
Live gateway playgroundBrowser-based request tester for validating gateway behavior before using it from the keyboard.

Why It Matters For Open Keyboard

Separation

Cleaner Product Boundary

  • The keyboard owns the user experience.
  • The gateway owns model access, keys, limits, and request routing.
  • Backend changes do not require redesigning the keyboard workflow.
Control

Safer Experimentation

  • Model choices can change behind the gateway.
  • Keys can be limited or disabled per client.
  • Secrets and runtime configuration stay outside the public website.

Current Focus

Hardening

Self-Hosted Readiness

  • Improve setup guidance for running the gateway outside a local development environment.
  • Continue validating quality and latency across local and hosted AI models.
  • Keep deployment checks and runtime secrets separate from public code.
Contracts

Client Integration

  • Keep grammar and writing-operation responses predictable for the keyboard.
  • Expand tests around gateway contracts and admin workflows.
  • Keep the public story focused on infrastructure capability, not production-scale claims.

Technology Stack

Gateway

TypeScript Hono Node.js CORS JSON logging JWT admin auth

Runtime

Docker Ollama OpenAI-compatible API Vitest Admin API

Repository Entry Points

The gateway repository contains the backend, admin UI, request routing code, config examples, and local verification workflow.

View the gateway implementation, or open the keyboard page to see the product experience it supports.