Skip to main content

Overview

This example demonstrates how to check API rate limits and health status using the Swarms API client.

Step 1: Installation

Install the required package:
pip install swarms-client python-dotenv

Step 2: API Key Setup

Set your API key in a .env file:
SWARMS_API_KEY=your_api_key_here

Step 3: Code Example

from swarms_client import SwarmsClient
from dotenv import load_dotenv
import os

load_dotenv()

client = SwarmsClient(api_key=os.getenv("SWARMS_API_KEY"))

response = client.client.rate.get_limits()
print(response)

print(client.health.check())
Run the script to check your current rate limits and API health status.