← 返回 Skills 市场
liudengkui

发票识别-发票查验-发票OCR(翔云开放平台)

作者 liudengkui · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
41
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install ocr-invoice-xiangyun
功能描述
翔云发票识别与查验 Skill。当用户请求以下操作时触发: - 发票识别、发票 OCR、识别发票 - 发票查验、发票验真、发票核验、核查发票真伪 - 扫描发票、读取发票信息、提取发票数据 - 增值税发票识别、电子发票识别、数电票识别 - 发票导出、发票台账、发票入账表、发票勾选抵扣 - 旅客运输抵扣表、货物明细表...
使用说明 (SKILL.md)

\r \r

xiangyun-invoice-ocr — 翔云发票识别与查验 Skill\r

\r 本 Skill 调用翔云平台 API,实现发票图片/PDF 识别 → 查验全流程。\r 导出功能仅在用户明确提出时才执行。\r \r ---\r \r

能力概览\r

\r | 功能 | 说明 |\r |:---|:---|\r | 发票识别 | 支持全票种(增值税专票/普票/数电票/电子票等),JPG/PNG/PDF/OFD |\r | 发票查验 | 识别后自动提取查验入参,联网核验真伪,返回完整票面信息 |\r | Excel 导出 | 5 种标准模版按发票类型自动匹配(仅用户明确要求时) |\r | 批量处理 | 支持单张和文件夹批量模式,批量前验证 key/secret |\r \r ---\r \r

凭据配置\r

\r 首次使用必须配置凭据。凭据存储于本 Skill 目录下的 config.json。\r \r 获取方式:登录 netocr.com → 个人中心 → 查看 key / secret\r \r 配置文件格式config.json):\r

{\r
  "key": "你的 ocrKey",\r
  "secret": "你的 ocrSecret"\r
}\r
```\r
\r
---\r
\r
## 脚本使用\r
\r
### 识别单张发票(仅识别)\r
```bash\r
python scripts/invoice.py --image \x3C发票路径>\r
```\r
\r
### 识别 + 查验(默认行为)\r
```bash\r
python scripts/invoice.py --image \x3C发票路径> --verify\r
```\r
\r
### 批量识别 + 查验(默认行为,批量前自动验证 key/secret)\r
```bash\r
python scripts/invoice.py --dir \x3C目录路径> --verify\r
```\r
\r
### 交互选择导出Excel模版(仅用户明确要求时才加 --export,并鼠标点选)\r
```bash\r
python scripts/invoice.py --image \x3C发票路径> --verify --export --select-template\r
python scripts/invoice.py --dir \x3C目录路径> --verify --export --select-template\r
```\r
脚本检测到 `--select-template` 时输出结构化标记并退出,由 Agent 调用 `ask_followup_question` 弹出多选窗口,用户点选后 Agent 将结果通过 `--template` 重新调用脚本。\r
\r
### 指定导出模版(仅配合 --export 使用)\r
```bash\r
# 单选\r
python scripts/invoice.py --image \x3C发票路径> --verify --export --template ledger\r
# 多选(逗号分隔)\r
python scripts/invoice.py --dir \x3C目录> --verify --export --template goods,booking\r
```\r
\r
模版名称及说明:\r
\r
| 编号 | 参数值 | 说明 |\r
|:---:|:---|:---|\r
| 1 | `deduction` | 增值税发票勾选抵扣表(抵扣进项税额) |\r
| 2 | `transport` | 国内旅客运输服务抵扣表(航空/铁路/客车/旅客运输服务/通行费) |\r
| 3 | `goods` | 增值税发票货物明细表(商品明细记录) |\r
| 4 | `ledger` | 增值税发票台账表(最全字段,覆盖广) |\r
| 5 | `booking` | 发票入账表(财务记账用) |\r
\r
> **严格票种过滤**:每个模板只导出其适用票种的数据,票种不匹配时自动跳过并提示 `[SKIP] {模版} 不适用于票种 {类型},跳过`。\r
> **空文件生成**:批量模式下,即使用户选择的模板没有任何匹配发票,也会生成空表头文件(仅标题+列头,无数据行)。\r
>\r
> **Agent 使用说明**:当用户需要导出但未指定 `--template` 时,Agent 应主动调用 `ask_followup_question`(multiSelect=true)展示 5 个模板选项供用户点选,再将结果通过 `--template` 参数传给脚本。\r
\r
---\r
\r
## 发票类型映射\r
\r
本 Skill 支持 **46 种**发票类型的识别,区分**可查验**与**仅识别**两大类。\r
\r
### 可查验(识别后可联网核验真伪)\r
\r
查验入参 `totalAmount` 按类型分两类取值:\r
\r
| 票种名称 | 票种代码 | totalAmount 取值 |\r
|:---|:---:|:---|\r
| 增值税专用发票 | 01 | `totalAmount`(不含税) |\r
| 机动车销售统一发票 | 03 | `totalAmount`(不含税) |\r
| 增值税普通发票 | 04 | `totalAmount`(不含税) |\r
| 增值税专用发票(电子) | 08 | `totalAmount`(不含税) |\r
| 电子发票(增值税专用发票) | 09 | `amountTax`(价税合计) |\r
| 增值税电子普通发票 | 10 | `totalAmount`(不含税) |\r
| 增值税普通发票(卷票) | 11 | `totalAmount`(不含税) |\r
| 通行费增值税电子普通发票 | 14 | `totalAmount`(不含税) |\r
| 二手车销售统一发票 | 15 | `totalAmount`(不含税) |\r
| 电子发票(航空运输电子客票行程单) | 61 | `amountTax`(价税合计) |\r
| 电子发票(铁路电子客票) | 62 | `amountTax`(价税合计) |\r
| 电子发票(机动车销售统一发票) | 63 | `totalAmount`(不含税) |\r
| 电子发票(二手车销售统一发票) | 64 | `totalAmount`(不含税) |\r
| 电子发票(普通发票)通行费 | 72 | `amountTax`(价税合计) |\r
| 电子发票(普通发票) | 83 | `amountTax`(价税合计) |\r
| 数电纸质发票(增值税专用发票) | 91 | `totalAmount`(不含税) |\r
| 数电纸票发票(普通发票) | 92 | `totalAmount`(不含税) |\r
| 数电纸质发票(机动车销售统一发票) | 93 | `totalAmount`(不含税) |\r
| 数电纸票发票(二手车销售统一发票) | 94 | `totalAmount`(不含税) |\r
\r
### 仅识别(不支持查验)\r
\r
| 票种名称 | 票种代码 |\r
|:---|:---:|\r
| 火车票 | 20 |\r
| 区块链发票 | 21 |\r
| 船票 | 22 |\r
| 定额发票 | 23 |\r
| 机打发票 | 24 |\r
| 出租车发票 | 25 |\r
| 客运汽车 | 26 |\r
| 航空运输电子客票行程单 | 27 |\r
| 过路费 | 28 |\r
| 打车行程单 | 31 |\r
| 货物清单 | 33 |\r
| 财政电子票据 | 34 |\r
| 海关缴款书 | 35 |\r
| 通用电子发票 | 36 |\r
| 完税证明 | 37 |\r
| 医疗票据 | 38 |\r
| 退票费报销凭证 | 39 |\r
| 非税收入一般缴款书(电子) | 40 |\r
| 车辆通行费通用(电子)发票 | 41 |\r
| 银行回单 | 42 |\r
\r
---\r
\r
## 5 种 Excel 模版及适用票种\r
\r
| 模版 | 参数值 | 适用票种代码 |\r
|:---|:---:|:---|\r
| 增值税发票勾选抵扣表 | `deduction` | 01,03,08,09,14,91,93,61,62,72 |\r
| 国内旅客运输服务抵扣表 | `transport` | 10,14,20,22,26,27,61,62,83,92,72 |\r
| 增值税发票货物明细表 | `goods` | 01,03,04,08,09,10,11,14,15,21,63,64,83,91,92,72 |\r
| 增值税发票台账表 | `ledger` | 01,03,04,08,09,10,11,14,15,21,61,62,63,64,83,91,92,72 |\r
| 发票入账表 | `booking` | 01,03,04,08,09,10,15,61,62,63,64,83,91,92,14,72 |\r
\r
---\r
\r
## Agent 执行规范\r
\r
### 默认行为(识别 + 查验)\r
当用户说"识别"、"OCR"、"扫描发票"等意图时:\r
- 单张:`--image \x3C路径> --verify`\r
- 目录:`--dir \x3C目录> --verify`\r
- **不加 --export**\r
\r
### 仅识别(不查验)\r
当用户明确说"仅识别"、"不查验"时:\r
- 去掉 `--verify` 参数\r
\r
### 导出 Excel\r
当用户明确提到"导出"、"台账"、"抵扣表"、"明细表"等时:\r
- 在识别查验基础上加上 `--export`\r
- 配合 `--template` 指定模板(可多选,逗号分隔)\r
\r
### 批量前验证\r
批量处理(`--dir`)时会自动先用空请求验证 key/secret 是否可用,若认证失败会提前报错并提示。\r
\r
---\r
\r
## 执行逻辑\r
\r
```\r
用户输入(图片/目录)\r
  │\r
  ├─ 检查 config.json → 若无 key/secret,要求用户配置后退出\r
  │\r
  ├─ 发票识别(recogInvoiveBase64.do,typeId=20090)\r
  │    └─ 解析返回:invoiceCode, invoiceNumber, billingDate,\r
  │                  totalAmount, checkCode, salesTaxNo 等\r
  │\r
  ├─ [--verify] 发票查验(verInvoice.do,typeId=3007)\r
  │    └─ 用识别结果自动填充查验入参\r
  │    └─ 返回完整票面 + 真伪状态\r
  │\r
  └─ [--export] 导出 Excel(仅用户明确要求)\r
       └─ 按 invoiceType 匹配模版\r
       └─ 写入对应字段,保存到 \x3C原文件名>_\x3C模版名>.xlsx\r
```\r
\r
---\r
\r
## API 参考\r
\r
- 发票识别:`https://netocr.com/api/v2/recogInvoiveBase64.do`(typeId=20090)\r
- 发票查验:`https://netocr.com/verapi/v2/verInvoice.do`(typeId=3007)\r
\r
---\r
\r
## 认证错误检测\r
\r
识别和查验接口返回时,会自动检测 key/secret 错误:\r
- 检测关键词:key、secret、密钥、认证、auth、unauthorized、401 等\r
- 检测到后打印友好提示,引导用户检查凭据或前往 netocr.com 重新获取\r
\r
---\r
\r
## ⚠️ 安全说明\r
\r
- 用户图片及 API 凭据通过 HTTPS 发送至翔云(netocr.com)进行处理\r
- 凭据仅存储于本地 `config.json`,不上传至任何其他平台\r
安全使用建议
Install or use this skill only if you trust netocr.com and the skill publisher. Process only the specific invoice files or folders you intend to upload, review the provider’s privacy terms for financial/tax documents, and protect or remove config.json after storing credentials.
功能分析
Type: OpenClaw Skill Name: ocr-invoice-xiangyun Version: 1.0.0 The skill bundle is a legitimate implementation for invoice OCR and verification using the Xiangyun (netocr.com) API. The Python scripts (invoice.py, export_invoice.py) are well-structured, align with the stated purpose in SKILL.md, and only communicate with the official API endpoints via HTTPS. No evidence of data exfiltration, malicious execution, or prompt injection was found.
能力标签
requires-sensitive-credentials
能力评估
Purpose & Capability
The stated purpose, scripts, and API endpoints align around invoice OCR, verification, and optional Excel export. The notable behavior is that invoice files and extracted financial/tax data are processed by an external provider.
Instruction Scope
The instructions are user-invoked, use explicit image or directory paths, and state that Excel export should only be performed when the user explicitly requests it.
Install Mechanism
There is no automatic install spec or remote installer, but the registry lists no source or homepage, so users have limited provenance information before trusting the code with invoice data and credentials.
Credentials
Reading invoice files, processing a user-selected directory, calling netocr.com, and writing Excel files are proportionate to the purpose, but users should carefully scope any batch directory.
Persistence & Privilege
The skill persists the netocr key/secret in config.json in the skill directory. This is disclosed and expected, but the file should be protected or removed when no longer needed.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install ocr-invoice-xiangyun
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /ocr-invoice-xiangyun 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial public release of xiangyun-invoice-ocr skill providing OCR and verification for Chinese invoices. - Supports full invoice processing flow: recognition, verification (for 46 invoice types), and Excel export in 5 standard templates. - Allows single and batch (directory) processing of images/PDFs, with automatic credential verification in batch mode. - Export templates are auto-matched by invoice type; multi-template export supported; empty result tables generated as needed. - Step-by-step, user-driven export options: explicit user intent required to export and select template(s). - Includes built-in error handling for API credential issues and provides user guidance for credential setup and troubleshooting.
元数据
Slug ocr-invoice-xiangyun
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

发票识别-发票查验-发票OCR(翔云开放平台) 是什么?

翔云发票识别与查验 Skill。当用户请求以下操作时触发: - 发票识别、发票 OCR、识别发票 - 发票查验、发票验真、发票核验、核查发票真伪 - 扫描发票、读取发票信息、提取发票数据 - 增值税发票识别、电子发票识别、数电票识别 - 发票导出、发票台账、发票入账表、发票勾选抵扣 - 旅客运输抵扣表、货物明细表... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 41 次。

如何安装 发票识别-发票查验-发票OCR(翔云开放平台)?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install ocr-invoice-xiangyun」即可一键安装,无需额外配置。

发票识别-发票查验-发票OCR(翔云开放平台) 是免费的吗?

是的,发票识别-发票查验-发票OCR(翔云开放平台) 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

发票识别-发票查验-发票OCR(翔云开放平台) 支持哪些平台?

发票识别-发票查验-发票OCR(翔云开放平台) 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 发票识别-发票查验-发票OCR(翔云开放平台)?

由 liudengkui(@liudengkui)开发并维护,当前版本 v1.0.0。

💬 留言讨论