Skip to content

About

Local-first AI workspace: chat with Claude, GPT, Gemini and Grok using your own keys. Switch models mid-chat, share one context, plug in MCP tools, run code in a sandbox.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Switchyard: any model in, one local workspace with your keys, hard caps, approvals and a sandbox, any capability out

Switchyard

Every model. Your keys. Your rules.

One local workspace for every frontier model: your keys, your context, your tools, your budget.

Switchyard is a local-first AI workspace that puts Claude, GPT, Gemini, Grok, DeepSeek and any OpenAI-compatible or local model behind one interface. Start a conversation with one model, continue it with another, give them all the same tools, and let them work on your files, while you stay in control of every tool call and every cent.

It runs on your own machine at 127.0.0.1. There is no account, no hosted backend and no telemetry. Your API keys live in the OS keychain, and your conversations live in a local SQLite database.

Why Switchyard? Models leapfrog each other every few months. Your workspace, your context and your tools should not have to move every time you switch. Switchyard is unified by capability, not vendor: you say what you want (search the web, think harder, run code, make an image, research deeply, ask several models) and Switchyard picks the mechanism and the model, within your budgets and permissions.


Contents


Highlights

  • Many vendors, one conversation. Switch model mid-chat; context carries over in a vendor-neutral format.
  • Honest costs. Tokens and cost on every message, budgets with server-enforced hard caps, and a cost preview before you send. Unknown cost is shown as unknown, never as zero.
  • Supervised autonomy. Every tool call goes through a permission gate that shows the exact arguments.
  • Sandboxed agents. Agent tasks run in a jailed folder with a Seatbelt-sandboxed shell, a change journal and one-click revert.
  • MCP made approachable. A connections gallery, config import, the official MCP registry and OAuth sign-in.
  • Capabilities for every model. Web search, code execution, image generation, artifacts, deep research and council mode work across vendors, natively where a model supports it and through Switchyard tools where it doesn't.
  • Built for control. Failover chains, a team policy file, a PII and secret filter, and a tamper-evident audit log.

See it in action

Asking a question, watching the answer stream in, then switching to another model mid-conversation

A formatted answer with token counts and the model picker
Chat with Markdown, code and per-message usage
The same conversation continued on another model
Switch models mid-conversation, context carried over
Two models answer and a judge merges their answers under a cost cap
Council mode: several models, one judge, a hard cost cap
An SVG drawn by the model, rendered in the sandboxed canvas
Artifacts canvas: model output rendered in a sandbox
Python code the model wrote, run in the sandbox after the user allowed it
Run code in a macOS sandbox, only after you approve the exact code

Features

Chat across vendors

  • Multi-provider chat with streaming replies, Markdown rendering, retry, and message actions.
  • Switch model mid-conversation. Any model can pick up any conversation, and context is stored in Switchyard's own canonical message format.
  • Compare mode. Send one prompt to several models side by side.
  • Auto routing. Rules pick a model for you.
  • Unified Think control. One Off / Low / Medium / High / Max setting, mapped to each vendor's own reasoning parameters. Levels a model can't do are disabled with a one-line reason.
  • Delivery modes per capability. The catalogue records, for each model and feature, whether it is delivered natively by the vendor, by a Switchyard tool, or not at all. The composer shows only what the chosen model can do, how, and at what cost.
  • Image and file attachments.
  • Per-chat instructions, saved prompts (type / in the composer), a command palette (Cmd/Ctrl+K) with full-text search over your chats, and chat export to Markdown or JSON.
  • Usage overview. Tokens and cost per model and per day, plus your top conversations.

Projects and context

  • Projects with their own instructions, memory entries and pinned files, shared by every model.
  • Token budgeting per model. When history nears the model's window, older turns are compacted into a stored summary that you can undo. The original messages are never altered.
  • Context meter and context report. See what is in the request and how much room is left.
  • "About you" memory across chats. Models can suggest facts to remember. Nothing is saved until you approve it, and approved entries apply to every model.
  • Document search over project files. A per-project document library, indexed with embeddings (OpenAI, Gemini, or a local Ollama model), searchable by any model through a gated tool. Index runs show an estimate first and count against your budgets.
  • Skills. Import Agent Skills folders (SKILL.md) from a folder, a .zip or pasted text, and use them as on-demand instructions with any tool-capable model. Imports are reviewed before saving, are off by default, and can be switched on per project. Skill scripts run only in the code sandbox, with approval on every run.

Tools, MCP and the permission gate

  • MCP servers over stdio or Streamable HTTP. You approve the exact command or URL, approve each server's tools, and enable them per project. Every vendor can call the same tools.
  • Connections gallery with prerequisite checks, a setup checklist and diagnostics.
  • Import MCP configs from other apps, and browse the official MCP registry.
  • OAuth sign-in for remote MCP servers.
  • Permission gate on every tool call. The exact arguments are shown, and you can allow once, deny, or save a rule per scope. Tool output is always treated as untrusted when it goes back to the model.

Agent tasks on your files

  • Guided tasks on a folder you choose, with a jail that keeps the agent inside it.
  • Shell access in a Seatbelt sandbox (macOS).
  • Change journal with revert. Every file change an agent makes can be rolled back.
  • MCP tools inside tasks, an approval card with a plain-language summary, and a task summary at the end.

Capabilities that work with any model

  • Web search with citations. Native search for Anthropic, OpenAI, Gemini, xAI and DeepSeek, with sources rendered as numbered citations. For other models, a Switchyard search tool backed by your own Brave or Tavily key. Search fees count toward your budgets.
  • Artifacts canvas. A side panel that renders HTML, SVG, Mermaid diagrams, Markdown documents and code files from any model's reply. It runs in a locked-down sandbox (sanitiser, strict CSP, script-free sandboxed iframe), keeps versions, and supports copy, download, edit and re-run.
  • Run code in chat. Python or JavaScript in a Seatbelt sandbox (macOS) with no network, a throwaway folder, time, memory, disk and output limits, and an explicit approval showing all the code before every run. Off until you opt in through a plain-language notice.
  • Deep research. A planned research task (plan, search, read, cite, write a report) with a hard cost cap shown before it starts, a progress view, numbered sources, a kill switch, and resume after restart. Page fetching is SSRF-safe.
  • Image generation, routed by capability to OpenAI, Gemini or xAI image models, with the price per picture shown first. Chat models that can't draw (Claude, DeepSeek) hand the description to an image model, with a visible note. Approval every time, and generated images are validated and stripped of metadata.
  • Council mode. Ask 2 to 4 models, then one judge model merges, critiques or picks the best answer. The worst-case cost is shown up front and must fit under your cap, answers reach the judge anonymised, and the judge is skipped if it would break the cap.
  • Voice. Browser dictation (on-device when the browser supports it, off until you opt in, never auto-sends) and read-aloud for replies.

Cost and control

  • Model catalogue with dated, sourced prices, pricing tiers, price overrides and retirement warnings.
  • Spend ledger, budgets and hard caps, enforced on the server, with a cost preview before each send.
  • Failover chains. Configurable fallback models with budget-aware candidates, visible notices, a simulator, and a data-residency switch so a chat never silently moves to another vendor you didn't allow.
  • Quota awareness from vendor rate-limit headers where vendors provide them.
  • Tamper-evident audit log (hash-chained) of what happened, without message content, with export and retention.
  • Team policy file (advisory or locked) for allowed providers and models, budgets, chains, tool rules and residency.
  • PII and secret filter that checks outgoing content before it leaves your machine.

App and portability

  • One command to run (pnpm start): the server serves the built web app on a single local port.
  • Export and import of conversations, projects and MCP settings (never keys, approvals or rules).
  • Desktop app for macOS, Windows and Linux, with a native folder picker. Download it from Releases, or run pnpm desktop from a checkout.
  • First-run guidance, connection tests, an accessibility pass, keyboard shortcuts, and a theme that follows your system.

Supported providers

Provider How it connects
Anthropic (Claude) API key, optional workspace id
OpenAI (GPT) API key, or Sign in with ChatGPT
Google Gemini API key
xAI (Grok) API key
DeepSeek API key (OpenAI-compatible adapter; a residency note is shown because its API is China-hosted)
OpenRouter, Groq, Together, Mistral Built-in presets on the OpenAI-compatible adapter
Ollama, LM Studio Local presets, no key needed
Any OpenAI-compatible endpoint Custom provider with your own URL and key

Optional extra services: Brave or Tavily for the Switchyard search tool, and OpenAI, Gemini or Ollama for document embeddings.


Download the app

Get the latest build from Releases:

System File
macOS, Apple Silicon (M1 and later) Switchyard-<version>-mac-arm64.dmg
macOS, Intel Switchyard-<version>-mac-x64.dmg
Windows 10 and 11 Switchyard-<version>-win-x64.exe
Linux Switchyard-<version>-linux-x86_64.AppImage

No Node.js or pnpm is needed. Your conversations and settings are kept in your user folder (on macOS, ~/Library/Application Support/Switchyard), and keys go to your system keychain.

The builds are not signed yet, so your system asks once before opening them:

  • macOS: open the app, choose Done on the warning, then go to System Settings, Privacy and Security and click Open Anyway.
  • Windows: on the SmartScreen notice, click More info, then Run anyway.
  • Linux: make the file executable (chmod +x Switchyard-*.AppImage) and run it. Saving keys needs a keyring service such as GNOME Keyring; without one, keys are kept only until you quit.

Run code and the agent shell need the macOS sandbox, so they are available on macOS only.


Quick start

Requirements

  • Node.js 24.8 or newer
  • pnpm 11.1.3, pinned in package.json. Run corepack enable and the pinned version is used automatically.
  • macOS for the sandboxed features (agent shell, Run code, skill scripts), which use Seatbelt. Everything else works on any OS, and the app shows a clear reason when a sandboxed feature isn't available.

Install and try it with no keys

git clone <your-fork-url> switchyard
cd switchyard
pnpm install                      # always run this first, including before `pnpm verify`

HUB_FAKE_PROVIDER=1 pnpm dev      # fake vendors with canned replies: no keys, no cost

The web app opens at http://localhost:5173 and the server listens on 127.0.0.1:4200.

Run it for real

pnpm dev                          # dev mode: Vite + server with hot reload
pnpm start                        # one-command app at http://127.0.0.1:4200
pnpm start --open                 # same, and opens your browser
pnpm desktop                      # optional Electron window
pnpm desktop:package --mac         # build the downloadable app (or --win, --linux)

Check it

pnpm install                      # needed before the first verify
pnpm verify                       # typecheck + lint + all tests, including end-to-end journeys
pnpm e2e                          # only the end-to-end journeys
pnpm format:check

On a busy machine, pnpm vitest run --maxWorkers=3 is gentler than the full parallel run.

Live checks (opt-in, costs money)

pnpm test:live does nothing unless you pass --live and the vendor's key is in your environment:

pnpm test:live --live --vendors=anthropic,gemini

Configuring provider keys

You have two options. Never paste a key into a chat or commit it to a file.

1. In the app (recommended). Open API keys in settings and paste your key. It is saved to your OS keychain (macOS Keychain, Windows Credential Manager, or the Linux Secret Service). If no keychain is available, the key is kept in memory until the server stops, and the app tells you so. Keys are used only inside the local server process and are never returned by any route, log or event. OpenAI users can choose Sign in with ChatGPT instead of a key.

2. Environment variables. Copy .env.example to .env (it is git-ignored) or export the variables in your shell. An environment key wins over a keychain key and shows as read-only in the app.

Variable Purpose
ANTHROPIC_API_KEY Claude
ANTHROPIC_WORKSPACE_ID Only if your Anthropic key isn't tied to one workspace
OPENAI_API_KEY OpenAI
GEMINI_API_KEY Google Gemini (Switchyard's name for it; GOOGLE_API_KEY is scrubbed from the server environment)
XAI_API_KEY xAI Grok
DEEPSEEK_API_KEY DeepSeek
HUB_PORT Server port (default 4200)
HUB_DATA_DIR Where the database and local files live (default ./data)
HUB_FAKE_PROVIDER=1 Use fake vendors for development and demos
HUB_APPROVAL_TIMEOUT_MS How long a tool call waits for your answer before counting as denied

Other providers (OpenRouter, Groq, Together, Mistral, custom endpoints), search keys (Brave, Tavily) and local models (Ollama, LM Studio) are added in the app.


Architecture

apps/web (React + Vite) ──HTTP + SSE──▶ apps/server (Hono, 127.0.0.1 only)
                                             │
                                        packages/core
   store (SQLite) · context · agent loop · MCP client · permission gate · providers
   budgets · failover · policy · PII filter · audit · search · research · run code · skills
                                             │
                                     packages/contracts (Zod)
apps/desktop (Electron, optional) wraps the same server in a native window.
Package Responsibility
packages/contracts Zod schemas and types: messages, stream events, tools, permissions, the HTTP API
packages/core The engine: store, context assembly, agent loop, MCP client, permission gate, provider adapters, budgets, failover, policy, audit, and capability services
apps/server HTTP and SSE API over core, key management, serving the built web app
apps/web The user interface. It imports only @hub/contracts
apps/desktop Optional Electron wrapper with a native folder picker
e2e/ End-to-end user journeys against fake vendors

One chat turn: the web app posts a message. The server loads the conversation and project and runs the agent loop. The loop builds one vendor-neutral system prompt (Switchyard, memory, skills, project layers, compaction summary), applies the token budget, and streams from the chosen provider adapter. Provider events become canonical events, streamed over SSE and stored. Each tool call is validated against its schema, passed through the permission gate (asking you when needed), run, and wrapped as untrusted before the next model call.

Design choices worth knowing:

  • Own agent loop and one adapter per vendor wire API (Anthropic Messages, OpenAI Responses, Gemini, and a generic Chat Completions adapter), rather than a lowest-common-denominator SDK.
  • Stateless toward vendors. Switchyard stores history itself and carries only the opaque reasoning state a vendor needs for correctness.
  • Config as data. Models, context windows, prices and capabilities live in models.json, with source links and verification dates.
  • Import boundaries enforced by ESLint. Provider SDKs only in providers/, the keychain only in keys/, MCP only in mcp/, child processes only in shell/, and only the gate can mint a tool permit.
  • No build step for workspace packages. They export TypeScript source directly (strict mode, ESM only).

Read more in docs/architecture.md, the decision records in docs/decisions/, the knowledge base in docs/kb/, and the HTTP API in docs/api-contract.md.


Security model

Switchyard runs code, calls tools and spends money for you, so it is built to fail closed.

  • Local only. The server binds to 127.0.0.1, and every /api call needs a per-install token (kept in the data dir with mode 0600). The data directory is 0700.
  • Keys never leave the server process and are never written to disk in plain text.
  • Every tool call is gated. High-risk tools (Run code, image generation, skill scripts) ask every time and ignore saved allow rules.
  • Untrusted content stays data. Tool output, search results, fetched pages and other models' answers are wrapped as untrusted before a model sees them.
  • Sandboxes. Agent shells and code runs use macOS Seatbelt profiles (no network, deny-by-default reads, home folder and secrets unreadable, resource limits, process-group kill). Artifacts render in a script-free sandboxed iframe behind a strict CSP.
  • Money. Budgets and hard caps are enforced on the server, with worst-case holds before each call.
  • Outbound calls go only to the providers and MCP servers you enabled, plus searches you start. Switchyard has no telemetry.
  • Reviewed. Every risky feature has had a dedicated security review, and the fixes landed as their own commits.

Seatbelt is a strong layer, not a guarantee. The opt-in notices say plainly what is and isn't protected.

Found a vulnerability? Please report it privately rather than opening a public issue. See SECURITY.md.


Project status

Switchyard is early-stage software built by one developer, published so others can use it, learn from it and help shape it.

  • The core features are built and covered by thousands of unit, integration and end-to-end tests, mostly against fake vendors.
  • Live checks against real vendors have been limited. Several vendor request shapes (especially image generation, native search fees and some embedding models) are implemented from documentation but not yet verified live. Reports from people with keys are very welcome.
  • Model prices and capabilities change monthly. The catalogue is dated and overridable, but it can go stale.
  • The project was called Hub during development. The app itself is now called Switchyard, but package names (@hub/*), environment variables (HUB_*), tool names (hub__*) and some server messages still use the old name, and will be renamed over time.
  • It is single-user and local by design. There is no hosted or multi-user mode.
  • Planned: .mcpb bundle import, native vendor code execution, video generation, real-time voice, signed and auto-updating desktop builds.

Contributing

Contributions are welcome: bug reports, live-vendor test results, provider adapters, docs and features.

  1. Fork and branch from main.
  2. Install and verify: pnpm install, then pnpm verify (and pnpm format:check).
  3. Read before you code: docs/architecture.md, the relevant file in docs/kb/concepts/, and any ADR in docs/decisions/ that touches your area. Larger changes start with a short ADR (see the existing ones for the format).
  4. Follow the house rules:
    • TypeScript strict, ESM, no any. Tests come with every change (Vitest; web tests use jsdom).
    • Respect the import boundaries. pnpm lint enforces them and tools/lint-rules.test.ts proves it.
    • Never log, return or commit a secret. Never call real vendors in the default test suite.
    • Anything that touches money, tokens, uploads, the shell, imports or outbound network calls gets an extra security look in review.
    • Prices and vendor facts in models.json must carry a source URL and a verification date.
  5. Keep commits focused with conventional-style messages (feat(scope): …, fix(scope): …), and open a pull request describing what changed and how you tested it.

Adding a provider? Start with docs/kb/concepts/provider-adapter.md and docs/kb/providers/catalogue.md.

Security issues: please don't open a public issue. Report them privately as described in SECURITY.md.

The full guide is in CONTRIBUTING.md.

The repository also includes the Claude Code setup used to build Switchyard (CLAUDE.md and .claude/ with agents, rules, hooks and skills). It is optional, but useful if you work with Claude Code.


License

Copyright 2026 Jamal Abbasi, arfabit.com.

Switchyard is licensed under the Apache License, Version 2.0. You may use, modify and distribute it, including commercially, as long as you keep the copyright and NOTICE and state any changes you make. Contributions are accepted under the same license.


Author

Jamal Abbasi Jamal Abbasi
Creator and maintainer of Switchyard
arfabit.com

About

Local-first AI workspace: chat with Claude, GPT, Gemini and Grok using your own keys. Switch models mid-chat, share one context, plug in MCP tools, run code in a sandbox.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages