Skip to main content

What This Example Shows

  • Setting up the Swarms API client
  • Checking API health status
  • Listing available models
  • Monitoring rate limits
  • Accessing swarm logs and availability

Installation

Get Your Swarms API Key

  1. Visit https://swarms.world/platform/api-keys
  2. Create an account or sign in
  3. Generate a new API key
  4. Store it securely in your environment variables

Code

Expected Output

The script will output JSON responses showing:
  • List of available AI models
  • API health status
  • Recent swarm execution logs
  • Current rate limit usage
  • Swarm service availability

Environment Setup

Create a .env file in your project directory:

Next Steps

After running this example, you’ll be ready to:
  • Create single agents for specific tasks
  • Build multi-agent swarms for complex workflows
  • Implement batch processing for multiple requests
  • Monitor and manage your API usage