Plato SDK

1.8.9 · active · verified Thu Apr 16

Plato SDK is a Python library that provides a convenient way to interact with the Plato API. It simplifies data access and operations with Plato's services, offering a client for models, insights, and other platform features. The current version is 1.8.9, and it appears to follow a regular release cadence with recent updates.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart initializes the Plato client using an API key retrieved from environment variables. It then attempts to fetch a list of available models from the Plato API, demonstrating a basic interaction. Error handling is included for common issues like missing API keys or network problems.

import os
from plato_sdk import Plato

# Initialize the Plato client with your API key
# Ensure PLATO_API_KEY is set in your environment or pass it directly.
api_key = os.environ.get("PLATO_API_KEY", "")
if not api_key:
    print("Warning: PLATO_API_KEY environment variable not set. API calls may fail.")
    # In a real app, you might raise an error here.
    # For this example, we'll continue with an empty key if not set.

plato = Plato(api_key=api_key)

# Example: Fetch a list of available models
try:
    # This call requires a valid API key and network connectivity
    models = plato.models.list()
    print("Available models:")
    for model in models:
        print(f"- {model.name} (ID: {model.model_id})")
except Exception as e:
    print(f"Error fetching models: {e}")
    print("Please check your API key and network connection.")

view raw JSON →