Skip to main content
SDKs are in very early alpha: We’re working as hard as we can to get them into a stable state. Please bear with us as we iterate rapidly.

Installation

pip install ai-stats-py-sdk

Requirements

  • Python 3.10+

Setup

API key

Create an API key in the AI Stats Dashboard.

Environment variable

export AI_STATS_API_KEY="aistats_v1_sk_<kid>_<secret>"

Basic usage

from ai_stats import AIStats
import os

client = AIStats(api_key=os.environ["AI_STATS_API_KEY"])

response = client.generate_text(
    {
        "model": "openai/gpt-5-nano",
        "messages": [{"role": "user", "content": "Hello!"}],
    }
)

print(response["choices"][0]["message"]["content"])

Optional client configuration

from ai_stats import AIStats

client = AIStats(
    api_key="your-api-key",
    base_url="https://api.phaseo.app/v1",
    timeout=30.0,
)

Next steps

Last modified on February 18, 2026