Skip to main content

Overview

switchAILocal is fully compatible with the OpenAI Node.js SDK. Point the SDK to your local switchAILocal instance to access all configured providers through one unified API.

Installation

Install the official OpenAI Node.js SDK:

Quick Start

Advanced Features

Multi-turn Conversations

Temperature and Parameters

CLI Attachments (Files & Folders)

Pass local files and folders to CLI providers:

CLI Flags (Auto-approve, Sandbox)

Session Management

List Available Models

Error Handling

TypeScript Support

The OpenAI SDK includes built-in TypeScript types:

Provider Prefixes

Omit the prefix to let switchAILocal automatically route to the best available provider.

Environment Variables

Next Steps

Python SDK

Use switchAILocal with Python

Go SDK

Embed switchAILocal in Go applications

Examples

See more usage examples

API Reference

Complete API documentation