# see2ai_llm_deepseek_v1

> SEE2AI 文本对话服务，支持深度思考、推理强度配置、工具调用和流式回复。适合问答、代码辅助、复杂推理和 Agent 自动化编排。

## 📖 接入指引

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

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

### Endpoints

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

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

## 📥 输入参数 (Input Schema)

```json
{
  "properties": {
    "query": {
      "description": "用户提示词或问题。",
      "title": "Query",
      "type": "string"
    },
    "enable_thinking": {
      "default": true,
      "description": "是否启用深度思考模式。",
      "title": "Enable Thinking",
      "type": "boolean"
    },
    "reasoning_effort": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": "high",
      "description": "可选推理强度：low / medium / high。",
      "title": "Reasoning Effort"
    },
    "temperature": {
      "default": 1.0,
      "description": "采样温度，用于控制回答随机性。",
      "maximum": 2.0,
      "minimum": 0.0,
      "title": "Temperature",
      "type": "number"
    },
    "stream": {
      "default": false,
      "description": "是否返回流式响应。",
      "title": "Stream",
      "type": "boolean"
    },
    "max_tokens": {
      "anyOf": [
        {
          "maximum": 384000,
          "minimum": 1,
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": 4096,
      "description": "请求的最大输出词元数。",
      "title": "Max Tokens"
    },
    "tools": {
      "anyOf": [
        {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "可选标准工具调用定义。",
      "title": "Tools"
    },
    "tool_choice": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "可选工具选择策略，例如 `auto`。",
      "title": "Tool Choice"
    },
    "response_format": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "可选标准响应格式配置。",
      "title": "Response Format"
    }
  },
  "required": [
    "query"
  ],
  "title": "DeepSeekV4ChatInput",
  "type": "object"
}
```

### 参数说明

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| `query` | string | ✅ 是 | `-` | 用户提示词或问题。 |
| `enable_thinking` | boolean | ❌ 否 | `True` | 是否启用深度思考模式。 |
| `reasoning_effort` | string / null | ❌ 否 | `high` | 可选推理强度：low / medium / high。 |
| `temperature` | number | ❌ 否 | `1.0` | 采样温度，用于控制回答随机性。 |
| `stream` | boolean | ❌ 否 | `False` | 是否返回流式响应。 |
| `max_tokens` | integer / null | ❌ 否 | `4096` | 请求的最大输出词元数。 |
| `tools` | array / null | ❌ 否 | `-` | 可选标准工具调用定义。 |
| `tool_choice` | string / object / null | ❌ 否 | `-` | 可选工具选择策略，例如 `auto`。 |
| `response_format` | object / null | ❌ 否 | `-` | 可选标准响应格式配置。 |

## 📤 输出结果 (Output Schema)

```json
{
  "$defs": {
    "DeepSeekV4UsageMetadata": {
      "properties": {
        "input_tokens": {
          "default": 0,
          "title": "Input Tokens",
          "type": "integer"
        },
        "output_tokens": {
          "default": 0,
          "title": "Output Tokens",
          "type": "integer"
        },
        "total_tokens": {
          "default": 0,
          "title": "Total Tokens",
          "type": "integer"
        }
      },
      "title": "DeepSeekV4UsageMetadata",
      "type": "object"
    }
  },
  "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": "服务来源。",
      "title": "Source",
      "type": "string"
    },
    "cost_points": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "预先计算的扣费词元（如果插件内部已经计算好费用，则直接使用此值，忽略基于词元的计算）",
      "title": "Cost Points"
    },
    "response": {
      "description": "SEE2AI 文本模型回答内容。",
      "title": "Response",
      "type": "string"
    },
    "thinking_content": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "深度思考过程内容（如本次调用返回）。",
      "title": "Thinking Content"
    },
    "tool_calls": {
      "anyOf": [
        {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "模型请求调用的工具列表。",
      "title": "Tool Calls"
    },
    "usage": {
      "anyOf": [
        {
          "$ref": "#/$defs/DeepSeekV4UsageMetadata"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "本次调用的用量统计。"
    },
    "provider_config_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "本次请求使用的内部配置 ID。",
      "title": "Provider Config Id"
    },
    "warnings": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "前置校验器返回的非阻断优化建议。",
      "title": "Warnings"
    }
  },
  "required": [
    "response"
  ],
  "title": "DeepSeekV4ChatOutput",
  "type": "object"
}
```

### 输出字段说明

| 字段名 | 类型 | 说明 |
|--------|------|------|
| `input_tokens` | integer | 输入消耗的词元数量 |
| `output_tokens` | integer | 输出消耗的词元数量 |
| `total_tokens` | integer | 总消耗的词元数量 |
| `model` | string | 实际使用的 SEE2AI 化身模型名称（由各 action 显式填写） |
| `source` | string | 服务来源。 |
| `cost_points` | integer / null | 预先计算的扣费词元（如果插件内部已经计算好费用，则直接使用此值，忽略基于词元的计算） |
| `response` | string | SEE2AI 文本模型回答内容。 |
| `thinking_content` | string / null | 深度思考过程内容（如本次调用返回）。 |
| `tool_calls` | array / null | 模型请求调用的工具列表。 |
| `usage` | object / null | 本次调用的用量统计。 |
| `provider_config_id` | integer / null | 本次请求使用的内部配置 ID。 |
| `warnings` | array / null | 前置校验器返回的非阻断优化建议。 |

## 💡 调用示例

### cURL 示例

```bash
curl -X POST "https://see2ai.com/api/v1/actions/see2ai_llm_deepseek_v1" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer sk-your-tenant-api-key" \
     -d '{
  "query": "Explain quantum entanglement in simple terms.",
  "enable_thinking": true,
  "reasoning_effort": "high",
  "temperature": 1.0,
  "stream": false,
  "max_tokens": 4096
}'
```

### Python 示例

```python
import requests

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

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

payload = {
  "query": "Explain quantum entanglement in simple terms.",
  "enable_thinking": true,
  "reasoning_effort": "high",
  "temperature": 1.0,
  "stream": false,
  "max_tokens": 4096
}

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

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

## 💰 计费说明

> Billed per token usage under the pricing SSOT. Input cache-hit price is registered for billing calculations, but this Action only exposes the standard prompt/output token counters.

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

## ⚠️ 常见错误码

| HTTP 状态码 | 错误原因 | 解决方案 |
| --- | --- | --- |
| `401` | SEE2AI API key authentication failed. | 检查 API Key 是否正确，或联系管理员充值 |
| `413` | Prompt exceeds the SEE2AI LLM (DeepSeek family) context budget. | 请稍后重试 |
| `422` | Input validation failed before the upstream call. | 检查请求参数是否符合 Schema 要求 |
| `429` | SEE2AI LLM service rate limit exceeded. | 降低请求频率，或联系管理员调整限流配置 |
| `502` | SEE2AI LLM upstream request failed, including platform auth/routing failures. | 请稍后重试 |
| `504` | SEE2AI LLM upstream timed out. | 请稍后重试 |

## 📞 技术支持

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

---

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