Skip to main content
Use this page when your first real Phaseo integration lives in Python and you want a practical starting point for a CLI, worker, or backend service. Goal: Run Phaseo control and generation routes from a small Python command-line application. Outcome: A dependency-light CLI you can adapt into a worker, script, or backend integration.

Build a Python gateway CLI around Phaseo routes.

Open in Cursor

Sample project

What this app does

  • supports control routes like:
    • GET /v1/health
    • GET /v1/models
    • GET /v1/providers
  • supports generation routes like:
    • POST /v1/responses
    • POST /v1/chat/completions
    • POST /v1/embeddings
    • and several additional endpoints

Why this sample is useful

It gives you:
  • a Python-first reference without third-party dependencies
  • explicit request payloads and response handling
  • a practical pattern for workers, scripts, and internal tools

Prerequisites

  • Python 3
  • a Phaseo API key

Run the sample

Set:
  • PHASEO_API_KEY
Then try:

Check your work

  • Smoke mode confirms that the API is reachable.
  • The Responses command prints integration_ok.
  • --help lists the supported commands without making a request.
  • Authentication and API failures produce clear terminal errors.

What to look at in the code

  • how the environment is loaded
  • how the CLI dispatches commands
  • how different request payloads are built
  • how async video and music routes are handled separately from one-shot text routes

How to make it your own

  • strip it down to only the endpoints your service needs
  • keep one shared request helper instead of duplicating headers everywhere
  • switch to the Python SDK later if you want a higher-level client
Last modified on July 26, 2026