# see2ai_image_uniworld_v2

> SEE2AI UniWorld2.5 图像生成服务，支持异步提交与进度查询，适合高质量视觉创作和复杂场景出图。

## 📖 接入指引

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

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

### Endpoints

| Method | Path | Purpose |
| --- | --- | --- |
| `POST` | `/api/v1/actions/see2ai_image_uniworld_v2` | Submit the standard action request. |
| `GET` | `/api/v1/actions/see2ai_image_uniworld_v2/status/{task_id}` | Poll the UniWorld job. When completed, read the final image from `image_url`. |

### Async Result Flow

1. Submit the generation request and save the returned `task_id`.
2. Poll `GET /api/v1/actions/see2ai_image_uniworld_v2/status/{task_id}` with the same API key until the task reaches a terminal status.
3. Read the final artifact URL from the status response. Use `image_url` for UniWorld and `result_urls` for image/video actions.

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

## 📥 输入参数 (Input Schema)

```json
{
  "properties": {
    "prompt": {
      "description": "Generation prompt. Hard limit: 5000 characters.",
      "maxLength": 5000,
      "title": "Prompt",
      "type": "string"
    },
    "canvas_w": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Canvas width in pixels.",
      "title": "Canvas W"
    },
    "canvas_h": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Canvas height in pixels.",
      "title": "Canvas H"
    },
    "style": {
      "anyOf": [
        {
          "maxLength": 255,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional style prompt.",
      "title": "Style"
    },
    "stylize": {
      "anyOf": [
        {
          "maxLength": 255,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional stylization prompt.",
      "title": "Stylize"
    },
    "skip_diffusion": {
      "default": false,
      "description": "Skip the refinement generation stage when supported.",
      "title": "Skip Diffusion",
      "type": "boolean"
    },
    "skip_harmonize": {
      "default": false,
      "description": "Skip the overall harmonization stage when supported.",
      "title": "Skip Harmonize",
      "type": "boolean"
    },
    "max_review_rounds": {
      "default": 0,
      "description": "Maximum review rounds.",
      "title": "Max Review Rounds",
      "type": "integer"
    },
    "hierarchical": {
      "default": false,
      "description": "Enable hierarchical planning when supported.",
      "title": "Hierarchical",
      "type": "boolean"
    }
  },
  "required": [
    "prompt"
  ],
  "title": "ImageUniworldV2Input",
  "type": "object"
}
```

### 参数说明

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| `prompt` | string | ✅ 是 | `-` | Generation prompt. Hard limit: 5000 characters. |
| `canvas_w` | integer / null | ❌ 否 | `-` | Canvas width in pixels. |
| `canvas_h` | integer / null | ❌ 否 | `-` | Canvas height in pixels. |
| `style` | string / null | ❌ 否 | `-` | Optional style prompt. |
| `stylize` | string / null | ❌ 否 | `-` | Optional stylization prompt. |
| `skip_diffusion` | boolean | ❌ 否 | `False` | Skip the refinement generation stage when supported. |
| `skip_harmonize` | boolean | ❌ 否 | `False` | Skip the overall harmonization stage when supported. |
| `max_review_rounds` | integer | ❌ 否 | `0` | Maximum review rounds. |
| `hierarchical` | boolean | ❌ 否 | `False` | Enable hierarchical planning when supported. |

## 📤 输出结果 (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"
    },
    "task_id": {
      "description": "SEE2AI task ID.",
      "title": "Task Id",
      "type": "string"
    },
    "status": {
      "description": "Current status after submit.",
      "title": "Status",
      "type": "string"
    },
    "provider_config_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Internal provider config ID.",
      "title": "Provider Config Id"
    },
    "warnings": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "List of non-blocking optimization suggestions.",
      "title": "Warnings"
    }
  },
  "required": [
    "task_id",
    "status"
  ],
  "title": "ImageUniworldV2SubmitOutput",
  "type": "object"
}
```

### 输出字段说明

| 字段名 | 类型 | 说明 |
|--------|------|------|
| `input_tokens` | integer | 输入消耗的词元数量 |
| `output_tokens` | integer | 输出消耗的词元数量 |
| `total_tokens` | integer | 总消耗的词元数量 |
| `model` | string | 实际使用的 SEE2AI 化身模型名称（由各 action 显式填写） |
| `source` | string | 服务来源（统一 `see2ai`；真实路由仅平台内部可见） |
| `cost_points` | integer / null | 预先计算的扣费词元（如果插件内部已经计算好费用，则直接使用此值，忽略基于词元的计算） |
| `task_id` | string | SEE2AI task ID. |
| `status` | string | Current status after submit. |
| `provider_config_id` | integer / null | Internal provider config ID. |
| `warnings` | array / null | List of non-blocking optimization suggestions. |

## 💡 调用示例

### cURL 示例

```bash
curl -X POST "https://see2ai.com/api/v1/actions/see2ai_image_uniworld_v2" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer sk-your-tenant-api-key" \
     -d '{
  "prompt": "Create a clean product visual with clear composition.",
  "skip_diffusion": false,
  "skip_harmonize": false,
  "max_review_rounds": 0,
  "hierarchical": false
}'
```

### Python 示例

```python
import requests

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

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

payload = {
  "prompt": "Create a clean product visual with clear composition.",
  "skip_diffusion": false,
  "skip_harmonize": false,
  "max_review_rounds": 0,
  "hierarchical": false
}

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

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

## 💰 计费说明

> Fixed price: 1 image = 50000 platform tokens (RMB 1).

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

## ⚠️ 常见错误码

| HTTP 状态码 | 错误原因 | 解决方案 |
| --- | --- | --- |
| `401` | Invalid or unauthorized API Key | 检查 API Key 是否正确，或联系管理员充值 |
| `402` | Insufficient balance | 请稍后重试 |
| `404` | Task not found when polling status | 请稍后重试 |
| `422` | Validation failed before upstream submit | 检查请求参数是否符合 Schema 要求 |
| `500` | SEE2AI UniWorld submit, polling, or re-hosting failed | 稍后重试，如持续失败请联系技术支持 |

## 📞 技术支持

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

---

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