Skip to main content
Until we have an official Python SDK, if you’d like to use a Python library rather than interacting directly with the API, you can use this recipe for a basic Python SDK for the Phylo API.

Prerequisites

  • An API key
  • Python 3.10 or later with the requests package
Install requests, then set your API key:
To use another API base URL, set the PHYLO_BASE_URL environment variable.

Functions in this recipe

  • create_project(): Creates a project.
  • list_projects(): Lists projects in the API key’s workspace.
  • create_task(): Creates a task in max and Auto mode by default, with optional initial messages.
  • upload_file(): Uploads files.
  • send_message(): Sends a message and optional file attachments to a task.
  • get_task(): Gets the current task status and metadata.
  • wait_for_task(): Polls until a task completes, fails, or is cancelled.
  • download_results(): Downloads every result file from a completed task.

Create the client

Copy this file and save it as phylo_client.py:
phylo_client.py
Run it to verify your API key by listing your projects:
To import it, place phylo_client.py beside your script: