Supported Providers
Swarms integrates with all major LLM providers through a consistent API:- OpenAI - GPT-5.4, o3
- Anthropic - Claude 4.x Opus, Sonnet, Haiku
- Groq - Ultra-fast inference with Llama
- DeepSeek - DeepSeek models
- Cohere - Command models
- Ollama - Local model deployment
- OpenRouter - Access to multiple providers
- XAI - Grok models
- Azure OpenAI - Enterprise OpenAI deployment
Configuration
Environment Setup
Configure your API keys in environment variables:Usage Examples
OpenAI Models
Use OpenAI’s GPT models by specifying the model name:Anthropic Claude
Claude models excel at long-form content and analysis:Groq (Ultra-Fast Inference)
Groq provides extremely fast inference speeds:DeepSeek
DeepSeek models for coding and reasoning:Ollama (Local Models)
Run models locally with Ollama:OpenRouter (Multi-Provider Access)
Access multiple providers through OpenRouter:Cohere
Cohere Command models:Model Naming Convention
Swarms uses the following naming pattern for models:- Direct provider models:
"gpt-5.4","claude-sonnet-4-6" - Provider prefix:
"groq/llama-3.3-70b-versatile","ollama/llama3.2" - OpenRouter:
"openrouter/provider/model-name"
is_model_available:
Advanced Configuration
Custom Model Parameters
Configure model-specific parameters:temperature defaults to None, which leaves it out of the request so the provider’s own default applies. max_tokens defaults to the model’s own output limit.
Dynamic Model Selection
Switch models dynamically based on task requirements:Multi-Provider Workflows
Combine different providers in a single workflow:Cost Optimization
Optimize costs by using the right model for each task:Best Practices
Choose the Right Model
Select models based on your specific use case - speed, cost, or capability
Monitor Usage
Track token usage per agent with
agent.usageTest Thoroughly
Test with multiple providers to find the best fit for your application
Fallback Strategy
Set
fallback_models so an agent moves to another provider when one failsNext Steps
MCP Integration
Connect to MCP servers for extended capabilities
Tools
Add custom tools to your agents