Skip to content

Multi Provider LLM

Toshon edited this page Jun 20, 2026 · 1 revision

Multi-Provider LLM

Perci's chat layer uses a factory pattern (src/lib/llm/clients.js) to support multiple LLM providers through a unified interface.


Supported Providers

Provider Auth Default Models Notes
OpenAI API key GPT-4o, GPT-4, o1, o3 Full feature support
Google Gemini API key Gemini 1.5 Pro, 1.5 Flash Streaming, vision
Anthropic Claude API key Claude 3.5 Sonnet, Opus Full feature support
Groq API key Llama 3.1, Mixtral Fast inference
DeepSeek API key DeepSeek V3, Coder Competitive coding
OpenRouter API key 337+ models One endpoint, many providers
Ollama None Any local model Port 11434
LM Studio None Any local model Port 1234, OpenAI-compatible
Jan None Any local model Port 1337/13370

Configuration

API keys are stored in:

  • Web: localStorage (plaintext — browser-managed)
  • Desktop: Electron safeStorage (encrypted at rest)

Keys are never sent to any server. They are stored locally and used only for outbound API calls from the browser/Electron renderer.

Add keys in Settings → API Keys.


Model Routing

Perci's ModelService (src/lib/llm/ModelService.js) handles:

  • Provider selection — which provider to use for a given conversation
  • Model listing — fetching available models from each provider
  • Auto-selection — picking a sensible default model when you switch providers
  • Fallback — if a provider call fails, Perci can retry with another

OpenRouter

OpenRouter is a unified API that gives you access to 337+ models from one endpoint. Perci's OpenRouter integration:

  • Fetches the public model catalog from openrouter.ai/api/v1/models
  • Displays models in a searchable picker
  • Sends the auth header only when a key exists
  • Falls back to keyless for public models

Local Models

No API key is needed. Perci auto-detects local runtimes:

Ollama:

ollama serve  # starts on port 11434

LM Studio: Start the OpenAI-compatible server from the LM Studio UI (port 1234).

Jan: Start Jan and enable the API server (port 1337). A proxy at ~/.hermes/scripts/jan_proxy.py handles the Jan-specific endpoint format.


Switching Providers Mid-Conversation

You can switch providers at any time. The conversation history is preserved, but the new provider will see the full context (messages are re-sent). Token limits vary by provider — very long conversations may be truncated.

Clone this wiki locally