# see2ai_scriptwriting_seedance_2_0_v1

> 将创意想法转化为符合 SEE2AI 官方视频生成引擎 规范的专业视频生成脚本/导演文档

## 📖 接入指引

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

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

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

## 📥 输入参数 (Input Schema)

```json
{
  "properties": {
    "brief": {
      "description": "用户关于短视频的创意、原始脚本或简报 (Brief)",
      "title": "Brief",
      "type": "string"
    },
    "sync": {
      "default": true,
      "description": "是否同步等待结果",
      "title": "Sync",
      "type": "boolean"
    }
  },
  "required": [
    "brief"
  ],
  "title": "SeedanceScriptInput",
  "type": "object"
}
```

### 参数说明

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| `brief` | string | ✅ 是 | `-` | 用户关于短视频的创意、原始脚本或简报 (Brief) |
| `sync` | boolean | ❌ 否 | `True` | 是否同步等待结果 |

## 📤 输出结果 (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": "实际使用的模型名称（由各 action 显式填写）",
      "title": "Model",
      "type": "string"
    },
    "source": {
      "default": "",
      "description": "模型提供商（由各 action 显式填写）",
      "title": "Source",
      "type": "string"
    },
    "cost_points": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "预先计算的扣费词元（如果插件内部已经计算好费用，则直接使用此值，忽略基于词元的计算）",
      "title": "Cost Points"
    },
    "task_id": {
      "description": "任务 ID",
      "title": "Task Id",
      "type": "string"
    },
    "status": {
      "description": "状态: PENDING, PROCESSING, SUCCESS, FAILED",
      "title": "Status",
      "type": "string"
    },
    "result": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "生成的符合 SEE2AI 官方视频生成引擎 标准格式的视频生成提示词/导演文档",
      "title": "Result"
    },
    "error_message": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "错误信息",
      "title": "Error Message"
    }
  },
  "required": [
    "task_id",
    "status"
  ],
  "title": "SeedanceScriptOutput",
  "type": "object"
}
```

### 输出字段说明

| 字段名 | 类型 | 说明 |
|--------|------|------|
| `input_tokens` | integer | 输入消耗的词元数量 |
| `output_tokens` | integer | 输出消耗的词元数量 |
| `total_tokens` | integer | 总消耗的词元数量 |
| `model` | string | 实际使用的模型名称（由各 action 显式填写） |
| `source` | string | 模型提供商（由各 action 显式填写） |
| `cost_points` | string | 预先计算的扣费词元（如果插件内部已经计算好费用，则直接使用此值，忽略基于词元的计算） |
| `task_id` | string | 任务 ID |
| `status` | string | 状态: PENDING, PROCESSING, SUCCESS, FAILED |
| `result` | string | 生成的符合 SEE2AI 官方视频生成引擎 标准格式的视频生成提示词/导演文档 |
| `error_message` | string | 错误信息 |

## 💡 调用示例

### cURL 示例

```bash
curl -X POST "https://see2ai.com/api/v1/actions/see2ai_scriptwriting_seedance_2_0_v1" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer sk-your-tenant-api-key" \
     -d '{
  "brief": "示例值",
  "sync": false
}'
```

### Python 示例

```python
import requests

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

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

payload = {
  "brief": "\u793a\u4f8b\u503c",
  "sync": false
}

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

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

## 💰 计费说明

> 按处理长度和生成长度计费。每 1,000 输入词元消耗0.015元，每 1,000 输出词元消耗0.02元。

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

## ⚠️ 常见错误码

| HTTP 状态码 | 错误原因 | 解决方案 |
| --- | --- | --- |
| `401` | API Key 无效或租户余额不足 | 检查 API Key 是否正确，或联系管理员充值 |
| `422` | 输入参数格式错误（如缺少 brief 字段） | 检查请求参数是否符合 Schema 要求 |
| `500` | 脚本生成过程中上游 LLM 服务异常，请重试 | 稍后重试，如持续失败请联系技术支持 |

## 📞 技术支持

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

---

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