Client
The main client for interacting with the Magpie Cloud API.
Magpie(api_key=None, base_url=None)
Parameters
| Parameter | Type | Description |
|---|---|---|
| api_key optional | str | Your Magpie Cloud API key. If not provided, will use MAGPIE_API_KEY environment variable. |
| base_url optional | str | Custom API base URL. Defaults to Magpie Cloud production endpoint. |
Example
from magpie import Magpie
# Using API key directly
client = Magpie(api_key="your_api_key_here")
# Using environment variable
import os
os.environ['MAGPIE_API_KEY'] = 'your_api_key_here'
client = Magpie()
# Custom endpoint (for self-hosted installations)
client = Magpie(
api_key="your_api_key_here",
base_url="https://api.your-domain.com"
) Client Attributes
The Magpie client exposes the following API interfaces:
- client.jobs - Jobs API for creating and managing compute jobs
- client.templates - Templates API for managing job templates