AI Provider Guide

July 22, 2026 ยท View on GitHub

Setting up and configuring AI providers in SAM


Overview

SAM connects to AI providers to power its conversation and tool capabilities. You can use cloud providers, local models, or a mix of both. This guide covers setup, configuration, and best practices for each provider.


Quick Comparison

ProviderCostSpeedPrivacyBest For
OpenAIPay-per-tokenFastCloudGeneral use, coding, creative writing
Anthropic---No direct provider. Use OpenRouter for Claude models.
GitHub CopilotSubscriptionFastCloudDevelopers with existing Copilot subscription
DeepSeekPay-per-token (low cost)FastCloudBudget-friendly general use
Google GeminiPay-per-tokenFastCloudGoogle ecosystem, multimodal
MiniMaxPay-per-tokenFastCloudCost-effective, large context
OpenRouterVaries by modelVariesCloudAccess to 100+ models
Ollama CloudPay-per-tokenVariesCloudCloud-hosted Ollama models
Z.AI (Chat)Pay-per-tokenFastCloudGLM models, Chinese/English bilingual
Z.AI (Coding)Pay-per-tokenFastCloudGLM coding models
MLX (Local)FreeVariesFull privacyOffline use, sensitive data, Apple Silicon
llama.cpp (Local)FreeVariesFull privacyOffline use, Intel or Apple Silicon
Remote llama.cppFreeVariesSelf-hostedSelf-hosted inference servers
Custom EndpointVariesVariesSelf-hostedSelf-hosted servers, Ollama, LM Studio

Cloud Providers

OpenAI

What you get: GPT-4o, GPT-4, GPT-3.5 Turbo, o1, o3 reasoning models

Setup:

  1. Create an account at platform.openai.com
  2. Go to API Keys and create a new key
  3. In SAM Settings > AI Providers, add OpenAI
  4. Paste your API key
  5. Select your default model

Model Recommendations:

  • GPT-4o - Best overall balance of speed, quality, and cost
  • GPT-3.5 Turbo - Fast and cheap for simple tasks
  • o1 / o3 - Reasoning models for complex logic and math (slower, more expensive)

Pricing: See openai.com/pricing for current rates.


GitHub Copilot

What you get: Access to GPT-4o, Claude 3.5, o1, and other models through your Copilot subscription.

Setup:

  1. You need an active GitHub Copilot subscription (Individual, Business, or Enterprise)
  2. In SAM Settings > AI Providers, add GitHub Copilot
  3. Click "Sign in with GitHub"
  4. SAM uses the GitHub device flow - you'll see a code to enter on github.com
  5. After authorization, SAM automatically manages token refresh

How It Works:

  • SAM authenticates via GitHub's device flow (no manual API key needed)
  • Tokens are refreshed automatically in the background
  • Available models depend on your Copilot subscription tier

Advantages:

  • No separate API key or billing
  • Uses your existing Copilot subscription
  • Access to multiple model providers through one authentication

DeepSeek

What you get: DeepSeek Chat, DeepSeek Coder

Setup:

  1. Create an account at platform.deepseek.com
  2. Create an API key
  3. In SAM Settings > AI Providers, add DeepSeek
  4. Paste your API key

Model Recommendations:

  • DeepSeek Chat - General conversation and tasks
  • DeepSeek Coder - Optimized for coding tasks

Advantages:

  • Significantly lower cost than OpenAI or Anthropic
  • Good quality for the price

Google Gemini

What you get: Gemini 2.5 Pro, Gemini 2.5 Flash, Gemini 2.0 Flash

Setup:

  1. Get an API key from aistudio.google.com
  2. In SAM Settings > AI Providers, add Gemini
  3. Paste your API key
  4. Select your default model

Model Recommendations:

  • Gemini 2.5 Pro - Top-tier reasoning and long context
  • Gemini 2.5 Flash - Fast and cost-effective
  • Gemini 2.0 Flash - Budget-friendly for simple tasks

Advantages:

  • Large context windows (up to 1M tokens on some models)
  • Strong multimodal capabilities
  • Competitive pricing

MiniMax

What you get: MiniMax-M3, MiniMax-M2.7, MiniMax-M2.5, and high-speed variants

Setup:

  1. Create an account at minimax.io
  2. Create an API key
  3. In SAM Settings > AI Providers, add MiniMax
  4. Paste your API key

Model Recommendations:

  • MiniMax-M3 - Latest model, best quality
  • MiniMax-M3-highspeed - Faster variant with slightly lower quality
  • MiniMax-M2.7 - Previous generation, still capable

Advantages:

  • 128K token context window
  • Competitive pricing
  • Good tool use capabilities

OpenRouter

What you get: Access to 100+ models from multiple providers through a single API.

Setup:

  1. Create an account at openrouter.ai
  2. Create an API key
  3. In SAM Settings > AI Providers, add OpenRouter
  4. Paste your API key
  5. Browse available models

Advantages:

  • One API key for dozens of providers
  • Try different models without separate accounts
  • Automatic routing and load balancing
  • Pay-per-token across all models

Recommended Model for New Users:

  • minimax/minimax-m2.7 - Excellent all-around model with 1M token context, strong reasoning, and competitive pricing. A great starting point when using OpenRouter.

Ollama Cloud

What you get: Cloud-hosted Ollama models without managing your own server.

Setup:

  1. Create an account at ollama.com
  2. Create an API key
  3. In SAM Settings > AI Providers, add Ollama Cloud
  4. Paste your API key
  5. Select a model from the available list

Advantages:

  • No local infrastructure needed
  • Access to popular Ollama models in the cloud
  • Pay-per-token pricing

Z.AI (Chat)

What you get: Z.AI's GLM models optimized for general conversation and reasoning.

Setup:

  1. Create an account at z.ai
  2. Create an API key
  3. In SAM Settings > AI Providers, add Z.AI (Chat)
  4. Paste your API key

Models: GLM-5.1, GLM-4.9

Features:

  • Strong bilingual capabilities (Chinese/English)
  • Chain-of-thought reasoning
  • Competitive pricing

Z.AI (Coding)

What you get: Z.AI's GLM models optimized for coding tasks.

Setup:

  1. Create an account at z.ai
  2. Create an API key
  3. In SAM Settings > AI Providers, add Z.AI (Coding)
  4. Paste your API key

Models: GLM-5.1, GLM-4.9

Features:

  • Specialized for code generation and analysis
  • Supports chain-of-thought reasoning for complex coding tasks
  • Large context windows

Local Models

MLX (Apple Silicon Only)

What you get: Run language models directly on your Mac using Apple's MLX framework with Metal GPU acceleration.

Requirements:

  • Apple Silicon Mac (M1, M2, M3, M4)
  • 8GB+ unified memory (16GB+ recommended)
  • macOS 14.0+

Setup:

  1. In SAM Settings > AI Providers, click Add Provider
  2. Choose "Local MLX Model"
  3. Browse available models
  4. Click Download on your chosen model
  5. Wait for the download to complete
  6. The model is ready to use

RAM Requirements:

Model SizeMinimum RAMRecommended RAM
1-3B parameters4GB8GB
7B parameters8GB16GB
13B parameters16GB32GB
30B+ parameters32GB64GB
70B parameters64GB96GB+

Performance Tips:

  • Larger models are more capable but slower
  • Unified memory means the GPU shares RAM with the system
  • Close other memory-intensive apps for best performance
  • First generation is slower (model loading), subsequent ones are faster

Advantages:

  • Complete privacy - nothing leaves your Mac
  • No internet connection needed after download
  • No per-token costs
  • Fast inference on Apple Silicon

llama.cpp (Any Mac)

What you get: Run GGUF-format models on any Mac, including Intel.

Requirements:

  • Any Mac (Apple Silicon or Intel)
  • 8GB+ RAM
  • macOS 14.0+

Setup:

  1. Download a GGUF model file (from Hugging Face or other sources)
  2. In SAM Settings > AI Providers, add llama.cpp
  3. Point to the model file location
  4. Configure context size and other parameters

Advantages:

  • Works on Intel Macs (unlike MLX)
  • Supports GGUF quantized models for lower memory usage
  • Wide model compatibility

Limitations:

  • Generally slower than MLX on Apple Silicon
  • Manual model file management

Remote llama.cpp

What you get: Connect to a remote llama.cpp server (e.g., running on a GPU server) for local-model inference without local hardware requirements.

Setup:

  1. Run a llama.cpp server on your remote machine:
    ./llama-server -m model.gguf --host 0.0.0.0 --port 8080
    
  2. In SAM Settings > AI Providers, add Remote llama.cpp
  3. Enter the server URL (e.g., http://192.168.1.100:8080)
  4. Configure authentication if needed

Use Cases:

  • Offload inference to a dedicated GPU server
  • Run larger models than your local machine can handle
  • Share a model server across multiple machines

Custom Endpoints

OpenAI-Compatible Servers

SAM can connect to any server that implements the OpenAI chat completions API. This includes:

  • Ollama - http://localhost:11434/v1
  • LM Studio - http://localhost:1234/v1
  • text-generation-webui - http://localhost:5000/v1
  • vLLM - http://localhost:8000/v1
  • Any OpenAI-compatible API

Setup:

  1. In SAM Settings > AI Providers, add a Custom provider
  2. Enter the endpoint URL (e.g., http://localhost:11434/v1)
  3. Enter an API key if required (some local servers don't need one)
  4. Configure the model name
  5. Test the connection

Managing Multiple Providers

Switching Between Providers

You can have multiple providers configured simultaneously and switch between them:

  • Use the model selector in the toolbar to pick a different model/provider
  • Switch mid-conversation - the history carries forward
  • Each conversation remembers which model was last used

Strategy Recommendations

Use CaseRecommended Approach
Daily useCloud provider (GPT-4o or Claude) for quality and speed
Sensitive contentLocal model (MLX) for complete privacy
Budget-consciousDeepSeek, MiniMax, or local models for routine tasks, GPT-4o for complex ones
CodingClaude or GPT-4o for best tool use, DeepSeek Coder for budget
Long documentsClaude (200K context), Gemini (1M context), or local models with large context
Offline useLocal models (MLX or llama.cpp)
ExperimentationOpenRouter for access to many models

Troubleshooting

"Authentication failed"

  • Verify your API key is correct
  • For GitHub Copilot: try signing out and back in
  • Check that your account has billing configured (cloud providers)

"Model not found"

  • The model may have been renamed or deprecated
  • Refresh the model list in Settings
  • Check the provider's documentation for current model names

"Rate limited"

  • You've exceeded the provider's rate limits
  • Wait a moment and try again
  • Consider upgrading your plan or using a different provider

"Request too large"

  • Your conversation has exceeded the model's context window
  • Start a new conversation
  • Use a model with a larger context window
  • SAM's context management should handle this automatically, but very long conversations with many tool calls can hit limits

Local model loading fails

  • Ensure you have enough free RAM
  • Try a smaller model
  • Check that the model file isn't corrupted (re-download if needed)
  • For MLX: verify you're on Apple Silicon
  • For llama.cpp: verify the file is in GGUF format

See Also