Skip to main content

Overview

switchAILocal is fully compatible with the OpenAI Python SDK. Simply point the SDK to your local switchAILocal instance and you can access all configured providers through a single, unified API.

Installation

Install the official OpenAI Python SDK:

Quick Start

Advanced Features

Multi-turn Conversations

Temperature and Parameters

CLI Attachments (Files & Folders)

Pass local files and folders to CLI providers like Gemini or Vibe:

CLI Flags (Auto-approve, Sandbox)

Control CLI behavior with standardized flags:

Session Management

Resume or name specific CLI sessions:

List Available Models

Error Handling

Provider Prefixes

Use these prefixes to route to specific providers:
Omit the prefix to let switchAILocal automatically route to the best available provider for that model.

Environment Variables

You can configure the client using environment variables:

Next Steps

Node.js SDK

Use switchAILocal with Node.js

Go SDK

Embed switchAILocal in Go applications

Examples

See more usage examples

API Reference

Complete API documentation