Skip to main content

Overview

This guide demonstrates the most common usage patterns for switchAILocal, from simple chat completions to multi-provider routing.

Simple Chat Completion

The most basic usage - send a message and get a response:

Auto-Routing (No Provider Prefix)

Let switchAILocal automatically select the best available provider:
Auto-routing prioritizes:
  1. CLI providers (if authenticated)
  2. API providers (if keys configured)
  3. Local providers (Ollama, LM Studio)

Explicit Provider Selection

Force routing to a specific provider using prefixes:

List Available Models

Discover all models from all configured providers:
Example Output:

Multi-turn Conversations

Maintain conversation context across multiple turns:

Temperature Control

Adjust creativity and randomness:

Max Tokens Limit

Control response length:

System Messages

Set the assistant’s behavior and personality:

Error Handling

Provider Prefix Reference

No Prefix = Auto-routing - switchAILocal will intelligently select the best available provider.

Next Steps

Streaming

Real-time streaming responses

Multi-Provider

Advanced multi-provider patterns

Intelligent Routing

Auto-routing with Cortex Router

Python SDK

Complete Python SDK reference