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
| Provider | Cost | Speed | Privacy | Best For |
|---|---|---|---|---|
| OpenAI | Pay-per-token | Fast | Cloud | General use, coding, creative writing |
| Anthropic | - | - | - | No direct provider. Use OpenRouter for Claude models. |
| GitHub Copilot | Subscription | Fast | Cloud | Developers with existing Copilot subscription |
| DeepSeek | Pay-per-token (low cost) | Fast | Cloud | Budget-friendly general use |
| Google Gemini | Pay-per-token | Fast | Cloud | Google ecosystem, multimodal |
| MiniMax | Pay-per-token | Fast | Cloud | Cost-effective, large context |
| OpenRouter | Varies by model | Varies | Cloud | Access to 100+ models |
| Ollama Cloud | Pay-per-token | Varies | Cloud | Cloud-hosted Ollama models |
| Z.AI (Chat) | Pay-per-token | Fast | Cloud | GLM models, Chinese/English bilingual |
| Z.AI (Coding) | Pay-per-token | Fast | Cloud | GLM coding models |
| MLX (Local) | Free | Varies | Full privacy | Offline use, sensitive data, Apple Silicon |
| llama.cpp (Local) | Free | Varies | Full privacy | Offline use, Intel or Apple Silicon |
| Remote llama.cpp | Free | Varies | Self-hosted | Self-hosted inference servers |
| Custom Endpoint | Varies | Varies | Self-hosted | Self-hosted servers, Ollama, LM Studio |
Cloud Providers
OpenAI
What you get: GPT-4o, GPT-4, GPT-3.5 Turbo, o1, o3 reasoning models
Setup:
- Create an account at platform.openai.com
- Go to API Keys and create a new key
- In SAM Settings > AI Providers, add OpenAI
- Paste your API key
- 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:
- You need an active GitHub Copilot subscription (Individual, Business, or Enterprise)
- In SAM Settings > AI Providers, add GitHub Copilot
- Click "Sign in with GitHub"
- SAM uses the GitHub device flow - you'll see a code to enter on github.com
- 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:
- Create an account at platform.deepseek.com
- Create an API key
- In SAM Settings > AI Providers, add DeepSeek
- 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:
- Get an API key from aistudio.google.com
- In SAM Settings > AI Providers, add Gemini
- Paste your API key
- 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:
- Create an account at minimax.io
- Create an API key
- In SAM Settings > AI Providers, add MiniMax
- 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:
- Create an account at openrouter.ai
- Create an API key
- In SAM Settings > AI Providers, add OpenRouter
- Paste your API key
- 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:
- Create an account at ollama.com
- Create an API key
- In SAM Settings > AI Providers, add Ollama Cloud
- Paste your API key
- 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:
- Create an account at z.ai
- Create an API key
- In SAM Settings > AI Providers, add Z.AI (Chat)
- 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:
- Create an account at z.ai
- Create an API key
- In SAM Settings > AI Providers, add Z.AI (Coding)
- 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:
- In SAM Settings > AI Providers, click Add Provider
- Choose "Local MLX Model"
- Browse available models
- Click Download on your chosen model
- Wait for the download to complete
- The model is ready to use
RAM Requirements:
| Model Size | Minimum RAM | Recommended RAM |
|---|---|---|
| 1-3B parameters | 4GB | 8GB |
| 7B parameters | 8GB | 16GB |
| 13B parameters | 16GB | 32GB |
| 30B+ parameters | 32GB | 64GB |
| 70B parameters | 64GB | 96GB+ |
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:
- Download a GGUF model file (from Hugging Face or other sources)
- In SAM Settings > AI Providers, add llama.cpp
- Point to the model file location
- 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:
- Run a llama.cpp server on your remote machine:
./llama-server -m model.gguf --host 0.0.0.0 --port 8080 - In SAM Settings > AI Providers, add Remote llama.cpp
- Enter the server URL (e.g.,
http://192.168.1.100:8080) - 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:
- In SAM Settings > AI Providers, add a Custom provider
- Enter the endpoint URL (e.g.,
http://localhost:11434/v1) - Enter an API key if required (some local servers don't need one)
- Configure the model name
- 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 Case | Recommended Approach |
|---|---|
| Daily use | Cloud provider (GPT-4o or Claude) for quality and speed |
| Sensitive content | Local model (MLX) for complete privacy |
| Budget-conscious | DeepSeek, MiniMax, or local models for routine tasks, GPT-4o for complex ones |
| Coding | Claude or GPT-4o for best tool use, DeepSeek Coder for budget |
| Long documents | Claude (200K context), Gemini (1M context), or local models with large context |
| Offline use | Local models (MLX or llama.cpp) |
| Experimentation | OpenRouter 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
- User Guide - Getting started with SAM
- Features - Complete feature reference
- project-docs/API_FRAMEWORK.md - API implementation details
- project-docs/API_INTEGRATION_SPECIFICATION.md - Provider integration specification
- project-docs/MLX_INTEGRATION.md - MLX implementation details