Build a Python gateway CLI around AI Stats routes.
Sample project
- GitHub: examples/gateway-python-quickstart
- Local repo path:
examples/gateway-python-quickstart
What this app does
- supports control routes like:
GET /v1/healthGET /v1/modelsGET /v1/providers
- supports generation routes like:
POST /v1/responsesPOST /v1/chat/completionsPOST /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
Run the sample
AI_STATS_API_KEY
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