# see2ai_image_normalize_v1

> SEE2AI image normalization service that generates an independent compressed image URL without mutating the original upload. Suitable for face analysis, visual understanding, video reference inputs, and image generation reference inputs.

## 📖 接入指引

**Endpoint**: `POST /api/v1/actions/see2ai_image_normalize_v1`

**认证方式**: Bearer Token (租户 API Key)

### Endpoints

| Method | Path | Purpose |
| --- | --- | --- |
| `POST` | `/api/v1/actions/see2ai_image_normalize_v1` | Submit the standard action request. |

> **⚠️ 重要提示**
> 
> 本 API 是 SEE2AI 平台标准化封装后的接口，**参数格式与任何上游 API 不同**。
> 请直接使用下方 Schema 中定义的参数，无需参考其他文档。
> 
> *例如：*
> *- 文本模型参数可能是 `query` 而不是 `messages` 数组*
> *- 视频模型参数可能是 `brief` (创意简报) 而不是复杂的配置项*

## 📥 输入参数 (Input Schema)

```json
{
  "properties": {
    "image_url": {
      "description": "Public HTTP(S) image URL to normalize into an independent SEE2AI-hosted provider input image.",
      "title": "Image Url",
      "type": "string"
    },
    "profile": {
      "default": "face_detection",
      "description": "SEE2AI normalization profile. Supports face analysis, VLM, storage canonicalization, video references, and image reference inputs.",
      "enum": [
        "face_detection",
        "vlm",
        "video_reference",
        "storage_canonical",
        "video_seedance_reference",
        "video_kling_reference",
        "image_generation_reference"
      ],
      "title": "Profile",
      "type": "string"
    }
  },
  "required": [
    "image_url"
  ],
  "title": "ImageNormalizeInput",
  "type": "object"
}
```

### 参数说明

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| `image_url` | string | ✅ 是 | `-` | Public HTTP(S) image URL to normalize into an independent SEE2AI-hosted provider input image. |
| `profile` | string enum | ❌ 否 | `face_detection` | SEE2AI normalization profile. Supports face analysis, VLM, storage canonicalization, video references, and image reference inputs. |

## 📤 输出结果 (Output Schema)

```json
{
  "properties": {
    "input_tokens": {
      "default": 0,
      "description": "输入消耗的词元数量",
      "title": "Input Tokens",
      "type": "integer"
    },
    "output_tokens": {
      "default": 0,
      "description": "输出消耗的词元数量",
      "title": "Output Tokens",
      "type": "integer"
    },
    "total_tokens": {
      "default": 0,
      "description": "总消耗的词元数量",
      "title": "Total Tokens",
      "type": "integer"
    },
    "model": {
      "default": "",
      "description": "实际使用的 SEE2AI 化身模型名称（由各 action 显式填写）",
      "title": "Model",
      "type": "string"
    },
    "source": {
      "default": "see2ai",
      "description": "服务来源（统一 `see2ai`；真实路由仅平台内部可见）",
      "title": "Source",
      "type": "string"
    },
    "cost_points": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "预先计算的扣费词元（如果插件内部已经计算好费用，则直接使用此值，忽略基于词元的计算）",
      "title": "Cost Points"
    },
    "original_url": {
      "description": "Original image URL.",
      "title": "Original Url",
      "type": "string"
    },
    "normalized_url": {
      "description": "Stable normalized image URL hosted as an independent OSS object.",
      "title": "Normalized Url",
      "type": "string"
    },
    "profile": {
      "description": "Normalization profile used.",
      "title": "Profile",
      "type": "string"
    },
    "original_bytes": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Original image size in bytes when known.",
      "title": "Original Bytes"
    },
    "normalized_bytes": {
      "description": "Normalized image size in bytes.",
      "title": "Normalized Bytes",
      "type": "integer"
    },
    "original_width": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Original image width when known.",
      "title": "Original Width"
    },
    "original_height": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Original image height when known.",
      "title": "Original Height"
    },
    "normalized_width": {
      "description": "Normalized image width.",
      "title": "Normalized Width",
      "type": "integer"
    },
    "normalized_height": {
      "description": "Normalized image height.",
      "title": "Normalized Height",
      "type": "integer"
    },
    "method": {
      "description": "Normalization method used: oss_process or pillow.",
      "title": "Method",
      "type": "string"
    },
    "warnings": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Non-blocking optimization or fallback notes from the normalization service.",
      "title": "Warnings"
    }
  },
  "required": [
    "original_url",
    "normalized_url",
    "profile",
    "normalized_bytes",
    "normalized_width",
    "normalized_height",
    "method"
  ],
  "title": "ImageNormalizeOutput",
  "type": "object"
}
```

### 输出字段说明

| 字段名 | 类型 | 说明 |
|--------|------|------|
| `input_tokens` | integer | 输入消耗的词元数量 |
| `output_tokens` | integer | 输出消耗的词元数量 |
| `total_tokens` | integer | 总消耗的词元数量 |
| `model` | string | 实际使用的 SEE2AI 化身模型名称（由各 action 显式填写） |
| `source` | string | 服务来源（统一 `see2ai`；真实路由仅平台内部可见） |
| `cost_points` | integer / null | 预先计算的扣费词元（如果插件内部已经计算好费用，则直接使用此值，忽略基于词元的计算） |
| `original_url` | string | Original image URL. |
| `normalized_url` | string | Stable normalized image URL hosted as an independent OSS object. |
| `profile` | string | Normalization profile used. |
| `original_bytes` | integer / null | Original image size in bytes when known. |
| `normalized_bytes` | integer | Normalized image size in bytes. |
| `original_width` | integer / null | Original image width when known. |
| `original_height` | integer / null | Original image height when known. |
| `normalized_width` | integer | Normalized image width. |
| `normalized_height` | integer | Normalized image height. |
| `method` | string | Normalization method used: oss_process or pillow. |
| `warnings` | array / null | Non-blocking optimization or fallback notes from the normalization service. |

## 💡 调用示例

### cURL 示例

```bash
curl -X POST "https://see2ai.com/api/v1/actions/see2ai_image_normalize_v1" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer sk-your-tenant-api-key" \
     -d '{
  "image_url": "https://example.com/image.jpg",
  "profile": "face_detection"
}'
```

### Python 示例

```python
import requests

API_KEY = "sk-your-tenant-api-key"
ENDPOINT = "https://see2ai.com/api/v1/actions/see2ai_image_normalize_v1"

headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {API_KEY}"
}

payload = {
  "image_url": "https://example.com/image.jpg",
  "profile": "face_detection"
}

response = requests.post(ENDPOINT, json=payload, headers=headers)
result = response.json()

print(f"结果：{result}")
```

## 💰 计费说明

> Each successful public call costs 0.01 CNY. Internal TUVE recovery paths may call the same service without exposing a separate user action.

**注意**: 所有费用都以词元为单位，系统会自动从租户余额中扣除。

## ⚠️ 常见错误码

| HTTP 状态码 | 错误原因 | 解决方案 |
| --- | --- | --- |
| `400` | Input validation failed before normalization. | 请稍后重试 |
| `401` | API Key invalid or tenant balance is insufficient. | 检查 API Key 是否正确，或联系管理员充值 |
| `422` | URL is unsafe, unsupported, or image cannot be normalized within provider limits. | 检查请求参数是否符合 Schema 要求 |
| `500` | Image download, OSS processing, or storage upload failed. | 稍后重试，如持续失败请联系技术支持 |

## 📞 技术支持

- **文档问题**: 查看 [SEE2AI 官方文档](https://see2ai.com/docs)
- **API 状态**: 访问 [服务状态页面](https://see2ai.com/status)
- **问题反馈**: 联系技术支持团队

---

**API 版本**: see2ai_image_normalize_v1
**最后更新**: 2026-03-23
