Skip to main content

Overview

The switchAILocal Go SDK allows you to embed the entire proxy server directly into your Go applications. This provides maximum flexibility and control over the AI gateway without requiring a separate server process.

Installation

Quick Start

Minimal Embed

The simplest way to embed switchAILocal:

Advanced Configuration

Adding Middleware

Custom Routes

Lifecycle Hooks

Custom Request Logger

Creating Custom Providers

Extend switchAILocal with your own provider implementations.

Implement the Executor Interface

Register Your Executor

Request/Response Translation

Register translators to convert between different API formats.

Register Custom Models

Make your models appear in /v1/models:

Programmatic Execution

Execute requests directly without the HTTP server:

Graceful Shutdown

Complete Example

See the custom provider example for a full working implementation.

Next Steps

Python SDK

Use switchAILocal with Python

Node.js SDK

Use switchAILocal with Node.js

Examples

See more usage examples

API Reference

Complete API documentation