Transparent local AI gateway for desktop workflows.
local-ai-gateway runs a localhost service that accepts OpenAI-compatible requests, validates a local API key, forwards requests to the configured upstream, and records usage logs. Upstream selection/configuration is intentionally kept outside the UI so tools such as cc switch can own provider setup.
- Starts a local gateway on
127.0.0.1, default port17777 - Exposes OpenAI-compatible base URL:
http://127.0.0.1:17777/v1 - Accepts local auth via
Authorization: Bearer <local_api_key>orx-api-key - Transparently forwards
/v1/*requests to the configured upstream - Records usage, latency, status, model, provider, and token metrics
- Provides a desktop dashboard for start/stop/restart, local key copy, and usage inspection
- It does not manage provider configuration in the desktop UI
- It does not implement model aliasing, routing rules, or protocol conversion in the UI
- It does not replace
cc switch; upstream configuration should be handled by that layer
pnpm install
pnpm devThe desktop renderer runs on http://localhost:1111 during development.
A Next.js test app is available in example/ai-sdk-next.
cd example/ai-sdk-next
pnpm install
pnpm devOpen:
http://localhost:4000
The page lets you enter:
- Local gateway API key
- Gateway base URL
- Model name
- Prompt
It calls Vercel AI SDK generateText through the local gateway.
pnpm typecheck
pnpm vitest run tests/api
cargo test --manifest-path src-tauri/Cargo.tomlReal upstream tests are available in Rust and are ignored unless the required environment variables are provided.
src/ Desktop React UI
src-tauri/ Tauri/Rust gateway backend
example/ai-sdk-next/ Next.js + AI SDK gateway test page
tests/ Frontend API logic tests
Runtime data is stored under:
~/.local-ai-gateway/
The SQLite database is created by the desktop app and includes gateway state, upstream metadata, and usage logs.