Metadata-Version: 2.4
Name: iot-image-sdk
Version: 0.1.0
Summary: IoT 平台文生图/图生图开放 API SDK（API Key 鉴权，同步返回，内置重试与错误映射）
Author: nexus2026-all
License: MIT
Project-URL: Repository, https://github.com/nexus2026-all/ai-iot-platform
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.24

# iot-image-sdk (Python)

文生图 / 图生图开放 API 的 Python SDK。

## 安装
```bash
pip install iot-image-sdk
```
（开发模式：`pip install -e sdk/python`）

## 快速开始
```python
from iot_image_sdk import IotImageClient
client = IotImageClient(api_key="sk-img-...", base_url="https://iot.hbthink.cn")
print(client.health())                       # 联调
r = client.text_to_image("赛博城市")          # 文生图
r2 = client.image_to_image("换背景", image_url="https://.../ref.png")  # 图生图
up = client.upload_image("./ref.png")        # 上传参考图
```

## 错误处理
所有非 2xx 业务错误抛 `IotImageError` 子类：
- `AuthenticationError`（401：Key 无效/缺失）
- `InvalidRequestError`（400：参数/参考图 URL 非法）
- `RateLimitError`（429：超频次/超配额）
- `TimeoutError`（504：生成超时）
- `ServiceError`（502：服务端错误）

可重试错误（超时/服务端/限流）默认指数退避重试 2 次；401/400 不重试。
