# Detect Client 这里放置不依赖 pipeline 的 Detect HTTP SDK 使用示例。SDK 只负责: - `list_models()` 查询 `active_push` 与 `passive_invoke` 能力; - `infer(category, image, media_type, parameters, image_roles)` 调用 `POST /v1/inference`; - 严格校验版本化响应,并把连接、HTTP 状态和协议错误分成不同异常。 客户端不得传入 `model_id`、权重路径或 pipeline 配置。模型选择和权重生命周期属于 `server/detect`;客户端只使用服务端公开的稳定业务 `category`。 安装 HTTP extra 后运行 [example.py](example.py): ```bash uv sync --extra http CMVR_DETECT_BASE_URL=http://127.0.0.1:8081 \ uv run --no-sync python client/detect/example.py ./sample.jpg detect.ppe ``` 远程服务配置了 `server.http.bearer_token` 时,通过环境变量传入同一 token;TLS 部署应把 base URL 改为 `https://`: ```bash CMVR_DETECT_BASE_URL=https://edge.example.com:8081 \ CMVR_DETECT_BEARER_TOKEN='deployment-secret' \ uv run --no-sync python client/detect/example.py ./sample.jpg detect.ppe ``` SDK 的生产代码位于 `cmvr_edge_ai.client.detect`。base URL、认证 header 和 timeout 属于调用应用配置;本目录不复制服务端 category/model/weights 配置。