ai-healthcheck
🌐 Multi-Language Support
Supported by Localizeflow
Lightweight health checks for OpenAI — no heavy SDKs required.
- Minimal data-plane calls with tiny payloads and short timeouts
- Clear, predictable behavior (always returns
HealthResult) - Small install footprint (uses
requestsonly) - Perfect for application startup probes and CI/CD smoke tests
Installation
pip install ai-healthcheck
Quickstart
Set your credentials (example using environment variables), then call the check.
import os
from ai_healthcheck import check_openai
res = check_openai(
endpoint=os.environ["OPENAI_ENDPOINT"], # e.g., https://api.openai.com
api_key=os.environ["OPENAI_API_KEY"],
model="gpt-4o-mini",
# Optional: scope to an organization if your account uses one
# org_id=os.environ.get("OPENAI_ORG_ID"),
)
print(res)
Sample output
# HealthResult(provider='openai',
# endpoint='https://api.openai.com',
# ok=True,
# status_code=200,
# message='OpenAI reachable. Credentials and model appear valid.')
Usage
from ai_healthcheck import check_openai
res = check_openai(
endpoint="https://api.openai.com",
api_key="***",
model="gpt-4o-mini",
# Optional organization header
# org_id="org_12345",
timeout=10.0,
)
print(res.ok, res.status_code, res.message)
Behavior:
- 200 -> ok=True
- else (401/403 and other non-2xx, or network errors) -> ok=False with details
Notes
- Uses
requestsonly; no SDK dependency. - No custom User-Agent header is set (keep requests minimal).
Troubleshooting
- 404: API key may be valid, but the endpoint/path or model name is likely incorrect. Verify the endpoint (e.g., include
/v1only once) and the model. - 401/403: Authentication/permission errors. Check API key and account access.
CI/CD and startup probes
Use these checks in your pipelines or app startup to fail fast with clear guidance.
def app_startup_probe():
from ai_healthcheck import check_openai
res = check_openai(endpoint=..., api_key=..., model=...)
if not res.ok:
raise RuntimeError(f"OpenAI health check failed: {res.message}")
Contributing
Contributions are welcome! Please open issues and pull requests on GitHub.
Metadata
Release files for ai-healthcheck 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ai_healthcheck-0.1.2.tar.gz | 4.1 kB | Without provenance | Details for ai_healthcheck-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ai_healthcheck-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for ai_healthcheck-0.1.2-py3-none-any.whl |
Total release size: 9.6 kB
Release files / ai_healthcheck-0.1.2.tar.gz
| Download URL | ai_healthcheck-0.1.2.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
32383b55f4669ce44eef5516b80738909a683f8d8b531b3417206cad4f9ffe31
|
|
BLAKE2b-256 checksum How to use checksums |
b101c3489fe016dd4fa4c6839f558e0d40713fb59bc7797dc7f55186d532a6bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / ai_healthcheck-0.1.2-py3-none-any.whl
| Download URL | ai_healthcheck-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb3c3339a10eb6c621869f86543403ed3cb420e7bdf74fb31bc55bec73fcd44b
|
|
BLAKE2b-256 checksum How to use checksums |
5b038312d8c8ac4d726b5ac9d152d92c9c3a85663fb9870ea2b990722bb8202e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for ai-healthcheck 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.