What is the Swarms API?
What is the Swarms API?
- Agent Orchestration: Create and manage AI agents that can work independently or collaborate
- Multi-Agent Communication: Enable agents to communicate and share information seamlessly
- Flexible Workflows: Support for sequential, concurrent, hierarchical, and other workflow patterns
- Enterprise Scale: A single swarm supports up to 2,000 agents (
SwarmSpec.agents) - Multi-Model Support: Integration with OpenAI, Anthropic, and Groq models
Why should I use the Swarms API?
Why should I use the Swarms API?
- Complete Agent Ecosystem: Full ecosystem for building, deploying, and scaling intelligent AI systems
- Advanced Multi-Agent Architectures: Build complex hierarchical, sequential, and parallel agent collaboration systems
- Agent-to-Agent Communication: Advanced communication protocols enable seamless agent interaction
- Ultra-Optimized Runtime: High-performance runtime with built-in optimization for concurrent operations
- Enterprise-Ready: Built-in security, governance, and compliance features
How does agent orchestration work?
How does agent orchestration work?
- Create Individual Agents: Deploy single agents for specific tasks
- Coordinate Multiple Agents: Build swarms where agents work together
- Define Workflow Patterns: Choose from sequential, concurrent, hierarchical, and other patterns
- Enable Communication: Agents can share information and collaborate
- Scale Dynamically: Add or remove agents based on workload
- Research teams with multiple agents researching different aspects
- Medical analysis with lab analyzer and clinical specialist working together
- Financial analysis with market analyst and economic forecaster collaborating
- Content creation with writer, editor, and fact-checker in sequence
What types of workflows are supported?
What types of workflows are supported?
swarm_type field on POST /v1/swarm/completions accepts 14 architectures:GET /v1/swarms/available.What models are supported?
What models are supported?
model_name field on AgentSpec. If model_name is omitted, the agent uses the default model, claude-sonnet-5.Premium-only models (rejected on the free tier, with a suggested free-tier alternative in the error response):gpt-5.6-sol,gpt-5.6-terra,gpt-5.6-luna,gpt-5.6claude-fable-5,claude-fable-5-1,claude-opus-5,claude-opus-5-5,claude-opus-4-8gemini-3.1-pro-preview,gemini-3.1-pro-preview-customtoolsxai/grok-4.5,xai/grok-4.5-latest- The same models on OpenRouter, e.g.
openrouter/openai/gpt-5.6-soloropenrouter/anthropic/claude-opus-4.8(full list on the Pricing page) - Any model id beginning with
groq/
:variant suffix.Free-tier alternatives the API suggests in place of these: claude-sonnet-5, gpt-5.5, gemini-3.5-flash (and claude-haiku-4-5, gpt-5.4-mini, gemini-3.5-flash-lite for the luna tier). Every other model id, including gpt-4.1, is available on the free tier.For the complete, up-to-date list of models your key can use, call GET /v1/models (or GET /v1/models/available for each model’s name and price per 1M tokens). Both leave premium-only models out of a free-tier key’s list.How much does it cost?
How much does it cost?
- Input and output tokens are billed at each model’s own price per 1M tokens, plus a 15% service fee.
- Prices come from OpenRouter for
openrouter/...models and from LiteLLM’s price data for every other model. A model with no price data is billed at fallback rates of $6.50 per 1M input and $18.50 per 1M output tokens before the fee. - OpenRouter free models (
openrouter/...ids ending in:free, andopenrouter/openrouter/free) cost $0 per token. - Call
GET /v1/models/availableorGET /v1/models/pricing?model_name=...for current prices, service fee included. For example, at the time of writinggpt-5.4costs $2.875 per 1M input and $17.25 per 1M output tokens.
web_scraper tool have no fee of their own; only the tokens are billed.Pricing applies to:- Swarm Completions (with agent cost)
- Agent Completions and Chat Completions
- Graph Workflow (with agent cost)
- Batched Grid Workflow (with agent cost)
- Reasoning Agents
- Auto Agent Builder ($0.01 per request)
- Decision Models (each decision model’s own price, from
GET /v1/decision/models)
- Night Time Discount: 50% off token costs for Swarm Completions during 8 PM - 6 AM Pacific Time, for paid members (Pro, Ultra or Premium, or an active subscription). Free accounts pay the full token price at any hour.
What are the rate limits?
What are the rate limits?
- 20x more requests per minute (2,000 vs 100)
- 28x more requests per hour (10,000 vs 350)
- 83x more requests per day (100,000 vs 1,200)
- 10x more tokens per agent (2M vs 200K)
How do I get started?
How do I get started?
What tools and integrations are available?
What tools and integrations are available?
- Search Capabilities: Web search integration for research tasks
- MCP Integration: Model Context Protocol for enhanced interactions
- Custom Tools: Define your own function tools for specific needs
- Connect to external data sources
- Integrate with databases and APIs
- Enable real-time data access for agents
How do I handle errors and troubleshooting?
How do I handle errors and troubleshooting?
- Verify your API key is correct and active
- Check that the
x-api-keyheader is properly set (theAuthorization: Bearer <key>header is also accepted) - Ensure your API key has the necessary permissions
- Implement exponential backoff for failed requests
- Monitor your API usage to stay within limits
- Consider upgrading to Premium for higher limits
- Increase request timeout values
- Consider breaking complex tasks into smaller chunks
- Use batch processing for multiple operations
- Check if your requested model is currently available
- Have fallback models configured
- Check
GET /v1/models/availablefor the models your key can use (GET /healthonly reports{"status": "ok"})
What security features are available?
What security features are available?
- API Key Authentication: Secure authentication for all requests
- Rate Limiting: Prevents abuse and ensures fair usage
- Data Encryption: All data is encrypted in transit and at rest
- Access Controls: Granular permissions and access management
- Never commit API keys to version control
- Use environment variables for all sensitive configuration
- Implement proper access controls in production environments
- Regularly rotate API keys
How can I get support?
How can I get support?
- Documentation: docs.swarms.ai
- Discord Community: Join Discord
- Technical Blog: Medium
- Technical Support: Book Support Session
- Enterprise Support: Contact through the platform
- Onboarding Sessions: Book with Kye Gomez
- Twitter: @kyegomez
- LinkedIn: The Swarm Corporation
- YouTube: Swarms Channel
Can I use Swarms for production applications?
Can I use Swarms for production applications?
- Scalability: Handle thousands of concurrent agents
- Enterprise Features: Security, compliance, and governance
- Monitoring: Comprehensive logging and analytics
- Support: Professional support for production deployments
- Implement proper error handling and retry logic
- Monitor API usage and costs
- Use appropriate rate limiting strategies
- Test thoroughly before deployment
- Keep API keys secure and rotate regularly
What's the difference between single agents and swarms?
What's the difference between single agents and swarms?
- Purpose: Focused tasks that don’t require collaboration
- Use Cases: Simple Q&A, content generation, data analysis
- Benefits: Fast, simple, cost-effective
- Limitations: Limited to single perspective, no collaboration
- Purpose: Complex tasks requiring multiple perspectives or specialized skills
- Use Cases: Research teams, medical analysis, financial forecasting
- Benefits: Multiple perspectives, specialized expertise, parallel processing
- Complexity: Higher setup and coordination requirements
How do I choose the right model for my use case?
How do I choose the right model for my use case?
- Use
gpt-5.4orclaude-sonnet-5for tasks requiring deep reasoning - Higher token limits for comprehensive analysis
- Choose gpt-4.1-mini for quick, straightforward tasks
- Lower costs for high-volume applications
- Higher temperature settings (0.7-0.9) work better
- GPT-4 or Claude models for creative content
- Lower temperature settings (0.1-0.3) provide more consistent responses
- Any model can work well with proper prompting
Can I integrate Swarms with my existing systems?
Can I integrate Swarms with my existing systems?
- REST API: Standard HTTP endpoints for any language
- Client Libraries: Official SDKs for Python, TypeScript, Go, Java
- Webhooks: Real-time notifications for long-running tasks
- Batch Processing: Process multiple requests efficiently
- Microservices: Deploy as independent services
- API Gateway: Integrate with existing API infrastructure
- Event-Driven: Trigger agents based on system events
- Scheduled Tasks: Run agents on regular schedules
Still Have Questions?
If you don’t see your question answered here, we’re here to help:- Join our Discord: discord.gg/EamjgSaEQf
- Book Technical Support: cal.com/swarms/swarms-technical-support