# az-ai-healthcheck
[](https://pypi.org/project/az-ai-healthcheck/)
[](https://github.com/skytin1004/az-ai-healthcheck/blob/main/LICENSE)
[](https://GitHub.com/skytin1004/az-ai-healthcheck/graphs/contributors/)
[](https://GitHub.com/skytin1004/az-ai-healthcheck/issues/)
[](https://GitHub.com/skytin1004/az-ai-healthcheck/pulls/)
[](http://makeapullrequest.com)
Lightweight health checks for Azure OpenAI and Azure AI Vision — no heavy SDKs required for OpenAI, and an optional extra for Vision.
- Minimal data-plane calls with tiny payloads and short timeouts
- Clear, predictable behavior (always returns `HealthResult`)
- Small install footprint; add Vision via optional extras
- Perfect for application startup probes and CI/CD smoke tests
## Installation
Core (OpenAI only):
```bash
pip install az-ai-healthcheck
```
With Vision support:
```bash
pip install "az-ai-healthcheck[vision]"
```
## Quickstart
Set your credentials (example using environment variables), then call the checks.
```python
import os
from az_ai_healthcheck import check_azure_openai, check_azure_ai_vision
res_aoai = check_azure_openai(
endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
api_key=os.environ["AZURE_OPENAI_API_KEY"],
api_version="2024-02-15-preview",
deployment="gpt-4o-mini",
)
print(res_aoai)
res_vision = check_azure_ai_vision(
endpoint=os.environ["AZURE_VISION_ENDPOINT"],
api_key=os.environ["AZURE_VISION_API_KEY"],
)
print(res_vision)
```
### Sample output
```python
# HealthResult full repr examples (your values will vary)
print(res_aoai)
# HealthResult(provider='azure_openai',
# endpoint='https://my-endpoint.openai.azure.com',
# ok=True,
# status_code=200,
# message='Azure OpenAI reachable. Credentials and deployment appear valid.')
print(res_vision)
# HealthResult(provider='azure_ai_vision',
# endpoint='https://my-cv.cognitiveservices.azure.com',
# ok=False,
# status_code=401,
# message='Azure Vision authentication/permission failed (401/403). Verify API key and endpoint.')
```
## Usage
### Azure OpenAI (Chat Completions) health check
```python
from az_ai_healthcheck import check_azure_openai
res = check_azure_openai(
endpoint="https://my-endpoint.openai.azure.com",
api_key="***",
api_version="2024-02-15-preview",
deployment="gpt-4o",
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
### Azure AI Vision (Image Analysis) health check
```python
from az_ai_healthcheck import check_azure_ai_vision
res = check_azure_ai_vision(
endpoint="https://my-cv.cognitiveservices.azure.com",
api_key="***",
timeout=10.0,
)
print(res.ok, res.status_code, res.message)
```
- Uses `ImageAnalysisClient.analyze` with `VisualFeatures.CAPTION`.
- Sends an in-memory PNG. `use_min_size_image=True` (default) uses 50x50 to reduce 400s.
- `use_min_size_image=False` can trigger 400 (e.g., InvalidImageSize) → returns ok=False with details.
- 404 is treated as failure with guidance (often wrong endpoint/path; occasionally an image too small to analyze).
## Notes
- Azure OpenAI uses `requests` only; no SDK dependency.
- Azure Vision requires `azure-ai-vision-imageanalysis` (install via extra).
- No custom User-Agent header is set (keep requests minimal).
## Troubleshooting
- Azure OpenAI 404: API key may be valid, but the endpoint/path, api-version, or deployment is likely incorrect. Verify the endpoint format (no extra path), the `api-version`, and the deployment name.
- Azure AI Vision 404: Often indicates a wrong endpoint/path. In some cases a too-small test image can also lead to errors—try the default `use_min_size_image=True`.
- 401/403: Permission/auth errors. Check keys, role assignments, and resource-level access.
## CI/CD and startup probes
Use these checks in your pipelines or app startup to fail fast with clear guidance.
```python
def app_startup_probe():
from az_ai_healthcheck import check_azure_openai
res = check_azure_openai(endpoint=..., api_key=..., api_version=..., deployment=...)
if not res.ok:
raise RuntimeError(f"OpenAI health check failed: {res.message}")
```
Raw data
{
"_id": null,
"home_page": null,
"name": "az-ai-healthcheck",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "azure, openai, vision, healthcheck, monitoring",
"author": "Minseok Song",
"author_email": "minseok.song@mssong.com",
"download_url": "https://files.pythonhosted.org/packages/31/50/932c1b3b46d623aba2213fa628c16581256b0eda799d76993b2c32380757/az_ai_healthcheck-0.1.5.tar.gz",
"platform": null,
"description": "# az-ai-healthcheck\n\n[](https://pypi.org/project/az-ai-healthcheck/)\n[](https://github.com/skytin1004/az-ai-healthcheck/blob/main/LICENSE)\n\n[](https://GitHub.com/skytin1004/az-ai-healthcheck/graphs/contributors/)\n[](https://GitHub.com/skytin1004/az-ai-healthcheck/issues/)\n[](https://GitHub.com/skytin1004/az-ai-healthcheck/pulls/)\n[](http://makeapullrequest.com)\n\nLightweight health checks for Azure OpenAI and Azure AI Vision \u2014 no heavy SDKs required for OpenAI, and an optional extra for Vision.\n\n- Minimal data-plane calls with tiny payloads and short timeouts\n- Clear, predictable behavior (always returns `HealthResult`)\n- Small install footprint; add Vision via optional extras\n- Perfect for application startup probes and CI/CD smoke tests\n\n## Installation\n\nCore (OpenAI only):\n\n```bash\npip install az-ai-healthcheck\n```\n\nWith Vision support:\n\n```bash\npip install \"az-ai-healthcheck[vision]\"\n```\n\n## Quickstart\n\nSet your credentials (example using environment variables), then call the checks.\n\n```python\nimport os\nfrom az_ai_healthcheck import check_azure_openai, check_azure_ai_vision\n\nres_aoai = check_azure_openai(\n endpoint=os.environ[\"AZURE_OPENAI_ENDPOINT\"],\n api_key=os.environ[\"AZURE_OPENAI_API_KEY\"],\n api_version=\"2024-02-15-preview\",\n deployment=\"gpt-4o-mini\",\n)\nprint(res_aoai)\n\nres_vision = check_azure_ai_vision(\n endpoint=os.environ[\"AZURE_VISION_ENDPOINT\"],\n api_key=os.environ[\"AZURE_VISION_API_KEY\"],\n)\nprint(res_vision)\n```\n\n### Sample output\n\n```python\n# HealthResult full repr examples (your values will vary)\n\nprint(res_aoai)\n# HealthResult(provider='azure_openai',\n# endpoint='https://my-endpoint.openai.azure.com',\n# ok=True,\n# status_code=200,\n# message='Azure OpenAI reachable. Credentials and deployment appear valid.')\n\nprint(res_vision)\n# HealthResult(provider='azure_ai_vision',\n# endpoint='https://my-cv.cognitiveservices.azure.com',\n# ok=False,\n# status_code=401,\n# message='Azure Vision authentication/permission failed (401/403). Verify API key and endpoint.')\n```\n\n## Usage\n\n### Azure OpenAI (Chat Completions) health check\n\n```python\nfrom az_ai_healthcheck import check_azure_openai\n\nres = check_azure_openai(\n endpoint=\"https://my-endpoint.openai.azure.com\",\n api_key=\"***\",\n api_version=\"2024-02-15-preview\",\n deployment=\"gpt-4o\",\n timeout=10.0,\n)\nprint(res.ok, res.status_code, res.message)\n```\n\nBehavior:\n- 200 -> ok=True\n- else (401/403 and other non-2xx, or network errors) -> ok=False with details\n\n### Azure AI Vision (Image Analysis) health check\n\n```python\nfrom az_ai_healthcheck import check_azure_ai_vision\n\nres = check_azure_ai_vision(\n endpoint=\"https://my-cv.cognitiveservices.azure.com\",\n api_key=\"***\",\n timeout=10.0,\n)\nprint(res.ok, res.status_code, res.message)\n```\n\n- Uses `ImageAnalysisClient.analyze` with `VisualFeatures.CAPTION`.\n- Sends an in-memory PNG. `use_min_size_image=True` (default) uses 50x50 to reduce 400s.\n- `use_min_size_image=False` can trigger 400 (e.g., InvalidImageSize) \u2192 returns ok=False with details.\n- 404 is treated as failure with guidance (often wrong endpoint/path; occasionally an image too small to analyze).\n\n## Notes\n\n- Azure OpenAI uses `requests` only; no SDK dependency.\n- Azure Vision requires `azure-ai-vision-imageanalysis` (install via extra).\n- No custom User-Agent header is set (keep requests minimal).\n\n## Troubleshooting\n\n- Azure OpenAI 404: API key may be valid, but the endpoint/path, api-version, or deployment is likely incorrect. Verify the endpoint format (no extra path), the `api-version`, and the deployment name.\n- Azure AI Vision 404: Often indicates a wrong endpoint/path. In some cases a too-small test image can also lead to errors\u2014try the default `use_min_size_image=True`.\n- 401/403: Permission/auth errors. Check keys, role assignments, and resource-level access.\n\n## CI/CD and startup probes\n\nUse these checks in your pipelines or app startup to fail fast with clear guidance.\n\n```python\ndef app_startup_probe():\n from az_ai_healthcheck import check_azure_openai\n res = check_azure_openai(endpoint=..., api_key=..., api_version=..., deployment=...)\n if not res.ok:\n raise RuntimeError(f\"OpenAI health check failed: {res.message}\")\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Lightweight health checks for Azure OpenAI and Azure AI Vision",
"version": "0.1.5",
"project_urls": {
"Repository": "https://github.com/skytin1004/az-ai-healthcheck"
},
"split_keywords": [
"azure",
" openai",
" vision",
" healthcheck",
" monitoring"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "70aeb26ff278e52766d66ce22775eeede85a62b2e1ee23a0a722367db1232926",
"md5": "330b51cbffc49265d15e2063018a4065",
"sha256": "f9ab730861f9db6b5e9bff757d50fa440760c0e056ac66da2acd1ee173aa2030"
},
"downloads": -1,
"filename": "az_ai_healthcheck-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "330b51cbffc49265d15e2063018a4065",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 8083,
"upload_time": "2025-08-28T02:19:25",
"upload_time_iso_8601": "2025-08-28T02:19:25.807579Z",
"url": "https://files.pythonhosted.org/packages/70/ae/b26ff278e52766d66ce22775eeede85a62b2e1ee23a0a722367db1232926/az_ai_healthcheck-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "3150932c1b3b46d623aba2213fa628c16581256b0eda799d76993b2c32380757",
"md5": "29d292646b3d54c75f938eccbe7dfa8a",
"sha256": "6c841124f7910f59871dc5001b4585246f47789116971b25c321de90030a1cc1"
},
"downloads": -1,
"filename": "az_ai_healthcheck-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "29d292646b3d54c75f938eccbe7dfa8a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 5958,
"upload_time": "2025-08-28T02:19:26",
"upload_time_iso_8601": "2025-08-28T02:19:26.556706Z",
"url": "https://files.pythonhosted.org/packages/31/50/932c1b3b46d623aba2213fa628c16581256b0eda799d76993b2c32380757/az_ai_healthcheck-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-28 02:19:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "skytin1004",
"github_project": "az-ai-healthcheck",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "az-ai-healthcheck"
}