examples/

directory
v0.5.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2026 License: Apache-2.0

README ΒΆ

switchAILocal Examples

This directory contains examples demonstrating how to extend and integrate with switchAILocal.

πŸ“ Structure

Directory Description
middleware/privacy-firewall Lua plugin that redacts PII from prompts
agent/active-coder Simple agent that generates and executes Python code
agent/bridge-executor WebSocket Relay API client (the "real" Bridge pattern)
configuration/resilient-router Tiered failover configuration example
advanced/custom-provider Go SDK extension for custom providers
legacy/translator Translation library usage (deprecated)

πŸš€ Quick Start

1. Privacy Firewall (Lua Plugin)

Intercepts requests and redacts emails/phone numbers before they leave your machine.

cd middleware/privacy-firewall
# Copy config to server root and start switchAILocal
2. Simple Coder (Agent)

Generates Python code from natural language and executes it locally.

cd agent/active-coder
pip install -r requirements.txt
python coder.py "Calculate the 20th Fibonacci number"
3. Bridge Executor (WebSocket)

Demonstrates the WebSocket Relay API used by Gemini CLI and Claude Code.

cd agent/bridge-executor
pip install -r requirements.txt
python executor.py models
4. Resilient Router (Config)

Shows a tiered failover strategy: Local β†’ Cheap Cloud β†’ Premium Cloud.

cd configuration/resilient-router
# Use this config.yaml with your switchAILocal server

Directories ΒΆ

Path Synopsis
Package main demonstrates how to create a custom AI provider executor and integrate it with the switchAILocal server.
Package main demonstrates how to create a custom AI provider executor and integrate it with the switchAILocal server.
legacy
translator command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL