# azure-ai-healthcheck
[](https://pypi.org/project/azure-ai-healthcheck/)
[](https://github.com/skytin1004/azure-ai-healthcheck/blob/main/LICENSE)
[](https://GitHub.com/skytin1004/azure-ai-healthcheck/graphs/contributors/)
[](https://GitHub.com/skytin1004/azure-ai-healthcheck/issues/)
[](https://GitHub.com/skytin1004/azure-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 azure-ai-healthcheck
```
With Vision support:
```bash
pip install "azure-ai-healthcheck[vision]"
```
## Quickstart
Set your credentials (example using environment variables), then call the checks.
```python
import os
from azure_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 azure_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 azure_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).
## HealthResult
```python
from azure_ai_healthcheck import HealthResult
# dataclass fields: provider, endpoint, ok, status_code, message
```
Providers: `"azure_openai"`, `"azure_ai_vision"`.
## 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 azure_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": "azure-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/e4/b9/143f043d80e544a37a89b576dc27656c8db84c2d489e797dd3eadaffb76e/azure_ai_healthcheck-0.1.1a2.tar.gz",
"platform": null,
"description": "# azure-ai-healthcheck\n\n[](https://pypi.org/project/azure-ai-healthcheck/)\n[](https://github.com/skytin1004/azure-ai-healthcheck/blob/main/LICENSE)\n\n[](https://GitHub.com/skytin1004/azure-ai-healthcheck/graphs/contributors/)\n[](https://GitHub.com/skytin1004/azure-ai-healthcheck/issues/)\n[](https://GitHub.com/skytin1004/azure-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 azure-ai-healthcheck\n```\n\nWith Vision support:\n\n```bash\npip install \"azure-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 azure_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 azure_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 azure_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## HealthResult\n\n```python\nfrom azure_ai_healthcheck import HealthResult\n# dataclass fields: provider, endpoint, ok, status_code, message\n```\n\nProviders: `\"azure_openai\"`, `\"azure_ai_vision\"`.\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 azure_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.1a2",
"project_urls": {
"Repository": "https://github.com/skytin1004/azure-ai-healthcheck"
},
"split_keywords": [
"azure",
" openai",
" vision",
" healthcheck",
" monitoring"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "022c8bcf7f41767165ef999cdbeb9cf096580cb6036afcb5a09161f577bf94ad",
"md5": "e58f21f4bbc9ee902402335cbebc7ce1",
"sha256": "fcfd63759406906488af45effd8ce268c96080b5853bc5eba7b3a1e084fa02e3"
},
"downloads": -1,
"filename": "azure_ai_healthcheck-0.1.1a2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e58f21f4bbc9ee902402335cbebc7ce1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 8205,
"upload_time": "2025-08-27T04:13:03",
"upload_time_iso_8601": "2025-08-27T04:13:03.746007Z",
"url": "https://files.pythonhosted.org/packages/02/2c/8bcf7f41767165ef999cdbeb9cf096580cb6036afcb5a09161f577bf94ad/azure_ai_healthcheck-0.1.1a2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e4b9143f043d80e544a37a89b576dc27656c8db84c2d489e797dd3eadaffb76e",
"md5": "9ba845f4de10f3cd044b278cbafba34a",
"sha256": "3a154af6175efdd12fe3ea587bb003d9415f8cb2b01a444523b8eb24c3af7d81"
},
"downloads": -1,
"filename": "azure_ai_healthcheck-0.1.1a2.tar.gz",
"has_sig": false,
"md5_digest": "9ba845f4de10f3cd044b278cbafba34a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 6008,
"upload_time": "2025-08-27T04:13:04",
"upload_time_iso_8601": "2025-08-27T04:13:04.479473Z",
"url": "https://files.pythonhosted.org/packages/e4/b9/143f043d80e544a37a89b576dc27656c8db84c2d489e797dd3eadaffb76e/azure_ai_healthcheck-0.1.1a2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-27 04:13:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "skytin1004",
"github_project": "azure-ai-healthcheck",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "azure-ai-healthcheck"
}