> ## Documentation Index
> Fetch the complete documentation index at: https://docs.swarms.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Client Example

> Python code example for setting up the Swarms API client and performing basic operations.

## Overview

This example demonstrates how to set up the Swarms API client and perform basic operations like checking health, models, and rate limits.

## Step 1: Installation

Install the required package:

```bash theme={null}
pip install swarms-client python-dotenv
```

## Step 2: API Key Setup

Set your API key in a `.env` file:

```bash theme={null}
SWARMS_API_KEY=your_api_key_here
```

## Step 3: Code Example

```python theme={null}
import os
import json
from dotenv import load_dotenv
from swarms_client import SwarmsClient

load_dotenv()

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

print(json.dumps(client.models.list_available(), indent=4))
print(json.dumps(client.health.check(), indent=4))
print(json.dumps(client.swarms.get_logs(), indent=4))
print(json.dumps(client.client.rate.get_limits(), indent=4))
print(json.dumps(client.swarms.check_available(), indent=4))
```

Run the script to see available models, API health, swarm logs, rate limits, and swarm availability.
