Official AI Stats Gateway SDK for Python.
Project description
AI Stats Python SDK
Official Python SDK for AI Stats Gateway.
Installation
pip install ai-stats-py-sdk
Requires Python 3.10+.
Quick start
from ai_stats import AIStats
client = AIStats() # Uses AI_STATS_API_KEY from environment
response = client.responses.create(
{
"model": "google/gemma-3-27b:free",
"input": "Reply with: Python SDK works",
}
)
print(response.get("output_text"))
Streaming example
from ai_stats import AIStats
client = AIStats()
for chunk in client.stream_text(
{
"model": "google/gemma-3-27b:free",
"messages": [{"role": "user", "content": "Stream hi"}],
}
):
print(chunk, end="", flush=True)
Common methods
client.responses.create(...)client.chat.completions.create(...)client.models.list(...)client.models.get_deprecation_info(model_id)client.models.validate(model_id)
Free and paid models
- Models with
:freein the model ID can be called with zero deposited credits. - Paid models require available wallet balance.
Model lifecycle warnings
from ai_stats import AIStats
client = AIStats(
enable_deprecation_warnings=True,
warnings_as_errors=False,
logger=lambda level, message, meta: print(level, message, meta),
)
Environment variables
AI_STATS_API_KEY(required unless passed in code)AI_STATS_BASE_URL(optional, defaults tohttps://api.phaseo.app/v1)
Devtools
from ai_stats import AIStats, create_ai_stats_devtools
client = AIStats(
devtools=create_ai_stats_devtools(
directory=".ai-stats-devtools",
capture_headers=False,
)
)
Regeneration and local checks
- Regenerate generated client:
pnpm openapi:gen:py - Run tests:
pnpm test:sdk-py - Smoke checks:
pnpm --filter @ai-stats/py-sdk run smoke:chatpnpm --filter @ai-stats/py-sdk run smoke:responses
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_stats_py_sdk-1.2.0.tar.gz.
File metadata
- Download URL: ai_stats_py_sdk-1.2.0.tar.gz
- Upload date:
- Size: 43.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cabd85135713016e19505c6c79ffb0c603a468a6432ec122eba28c6c5276ad7
|
|
| MD5 |
e32cd2d9bc22f787d38ff8dcac5e1dba
|
|
| BLAKE2b-256 |
953a6abfbea9537f6e7d45855fc66d70621c448a79cd78bbe5966f8c5ef8e427
|
Provenance
The following attestation bundles were made for ai_stats_py_sdk-1.2.0.tar.gz:
Publisher:
ci.yml on AI-Stats/AI-Stats
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_stats_py_sdk-1.2.0.tar.gz -
Subject digest:
5cabd85135713016e19505c6c79ffb0c603a468a6432ec122eba28c6c5276ad7 - Sigstore transparency entry: 1338671962
- Sigstore integration time:
-
Permalink:
AI-Stats/AI-Stats@374dd7558b3d7d65e90f5c013184d65b12dc94e1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AI-Stats
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@374dd7558b3d7d65e90f5c013184d65b12dc94e1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ai_stats_py_sdk-1.2.0-py3-none-any.whl.
File metadata
- Download URL: ai_stats_py_sdk-1.2.0-py3-none-any.whl
- Upload date:
- Size: 50.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f4ed03ae93db704504ded7a2092d29b9d9114f41eab7c016a93d57a0be29baf
|
|
| MD5 |
4282ae42a5b3bdbd26090ea77ca8fa9f
|
|
| BLAKE2b-256 |
48b34f4de5ca297a0eeeb15875a1544a48c7d7db68774eef3c3f64d064e72ddf
|
Provenance
The following attestation bundles were made for ai_stats_py_sdk-1.2.0-py3-none-any.whl:
Publisher:
ci.yml on AI-Stats/AI-Stats
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_stats_py_sdk-1.2.0-py3-none-any.whl -
Subject digest:
0f4ed03ae93db704504ded7a2092d29b9d9114f41eab7c016a93d57a0be29baf - Sigstore transparency entry: 1338671965
- Sigstore integration time:
-
Permalink:
AI-Stats/AI-Stats@374dd7558b3d7d65e90f5c013184d65b12dc94e1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AI-Stats
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@374dd7558b3d7d65e90f5c013184d65b12dc94e1 -
Trigger Event:
push
-
Statement type: