> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://developers.alephant.io/sdk-reference/saa-s-sdk/python-sdk/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.alephant.io/_mcp/server. # Python SDK > Installation, configuration, and usage of the Alephant Python SDK The official Alephant Python SDK provides access to the Alephant SaaS API from Python applications. It supports both synchronous and asynchronous usage and is fully type-hinted. ## Installation Install the SDK via pip: ```bash pip install alephantai-saas-api ``` ## Initialization You can initialize either a synchronous or asynchronous client depending on your application architecture. ### Synchronous Client ```python import os from alephantai_saas import AlephantAi318537Api client = AlephantAi318537Api( base_url=os.environ["ALEPHANT_SAAS_BASE_URL"], api_key=f"Bearer {os.environ['ALEPHANT_API_TOKEN']}", ) ``` ### Asynchronous Client For modern async frameworks like FastAPI or Starlette: ```python import os from alephantai_saas import AsyncAlephantAi318537Api async_client = AsyncAlephantAi318537Api( base_url=os.environ["ALEPHANT_SAAS_BASE_URL"], api_key=f"Bearer {os.environ['ALEPHANT_API_TOKEN']}", ) ``` ## Example Usage ### Smoke test Use the health endpoint to verify that the SDK can reach your configured SaaS API host. ```python response = client.system.health_check() print(response) ``` ### Listing Workspaces ```python def fetch_workspaces(): try: response = client.workspaces.list_users_workspaces() for workspace in response.data: print(f"Workspace: {workspace.name} (ID: {workspace.id})") except Exception as e: print(f"Error fetching workspaces: {e}") ``` ### Fetching Agent Analytics ```python async def get_agent_metrics(agent_id: str): analytics = await async_client.analytics.get_agent_analytics( agent_id=agent_id, period="7d" ) print(f"Total Cost: ${analytics.total_cost}") print(f"Total Requests: {analytics.total_requests}") ``` ## Base URL The SaaS SDK requires an explicit `base_url`. Use the dev, production, or private deployment host for your environment. ```python client = AlephantAi318537Api( base_url="https://alephant.your-company.com/api", api_key="Bearer ", ) ``` > Integrate Alephant into your Python applications