Skip to main content

Introduction

switchAILocal provides an OpenAI-compatible HTTP API that works with any OpenAI SDK or tool. Point your client to http://localhost:18080/v1 and use your existing code without modifications.

Base URL

All API endpoints use this base URL. The server runs locally on your machine by default.

Key Features

OpenAI Compatible

Works with OpenAI SDKs in Python, Node.js, and more without code changes

Multi-Provider

Access Gemini, Claude, Ollama, and other providers through a single endpoint

Auto-Routing

Omit provider prefixes to let switchAILocal choose the best available provider

Local-First

Everything runs on your machine - your data never leaves

Quick Example

Available Endpoints

Provider Support

switchAILocal supports multiple AI providers through a unified interface:

CLI Providers (Use Your Subscriptions)

  • Gemini CLI (geminicli:) - Google Gemini via local CLI
  • Claude CLI (claudecli:) - Anthropic Claude via local CLI
  • Codex (codex:) - OpenAI Codex
  • Vibe (vibe:) - Mistral Vibe CLI
  • OpenCode (opencode:) - OpenCode CLI

Local Models

  • Ollama (ollama:) - Local open-source models
  • LM Studio (lmstudio:) - Local model hosting

Cloud APIs

  • switchAI (switchai:) - Traylinx unified gateway
  • Gemini API (gemini:) - Google AI Studio
  • Claude API (claude:) - Anthropic API
  • OpenAI API (openai:) - OpenAI platform
  • OpenAI Compatible (openai-compat:) - OpenRouter, etc.

Error Handling

All errors follow the OpenAI error format:

Common Error Types

Next Steps

Authentication

Learn how to authenticate API requests

Chat Completions

Send messages and receive AI responses

Provider Prefixes

Route requests to specific providers

Management API

Configure and monitor your server