← 返回
未分类 Key

test

Recognize and extract structured data from invoices, receipts, and bills using iFlytek OCR API (科大讯飞票据识别). Supports VAT invoices, taxi receipts, train tickets, toll invoices, medical bills, bank receipts, and more.
user_265fda35
未分类 community v1.0.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 127
下载
💾 4
安装
1
版本
#latest

概述

xfyun-invoice

OCR-based invoice and receipt recognition using the iFlytek (科大讯飞) API. Extracts structured fields from photos or scans of Chinese invoices and bills.

When to Use

  • User provides an invoice/receipt image and wants structured data extracted
  • Need to digitize paper invoices (增值税发票、出租车票、火车票、医疗票据 etc.)
  • Expense report automation — extract amounts, dates, vendor info from receipts

Prerequisites

  • Python 3 (standard library only, no pip install needed)
  • Environment variables (get from 讯飞控制台):
  • XFYUN_APP_ID — Application ID
  • XFYUN_API_KEY — API Key
  • XFYUN_API_SECRET — API Secret

Supported Image Formats

png, jpg/jpeg, bmp, gif, tif/tiff, pdf

Usage

The script is at scripts/invoice.py relative to this skill directory.

Basic Recognition

python3 scripts/invoice.py /path/to/invoice.png

Options

FlagDescription
-------------------
--rawOutput raw API JSON response instead of formatted text

Examples

# Recognize a VAT invoice
python3 scripts/invoice.py ./vat_invoice.jpg

# Recognize a medical receipt with raw output
python3 scripts/invoice.py ./medical_bill.png --raw

# Recognize a taxi receipt
python3 scripts/invoice.py ./taxi_receipt.jpg

Output Format (default)

Human-readable structured fields:

票据类型: 增值税普通发票

发票代码: 012345678901
发票号码: 12345678
开票日期: 2026年03月06日
金额: ¥1,234.56
...

Output Format (--raw)

Full API JSON response including all metadata and encoded payload.

Authentication

Uses HMAC-SHA256 signature-based auth (讯飞鉴权). The script handles all signing automatically — just set the three environment variables.

API Details

  • Endpoint: POST https://api.xf-yun.com/v1/private/sc45f0684
  • Auth: HMAC-SHA256 signature in URL query parameters
  • Image limit: Check your service tier on 讯飞控制台

Error Codes

CodeMeaning
---------------
0Success
10105Unauthorized app or invalid signature
10110Missing required field
10163Request body too large
10200Image read failed
11200Quota exceeded

Tips

  • Ensure the image is clear and well-lit for best accuracy
  • Crop to just the invoice area if possible (reduces noise)
  • PDF support means you can pass scanned documents directly

版本历史

共 1 个版本

  • v1.0.0 Initial release 当前
    2026-04-08 20:04 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

office-efficiency

Word / DOCX

ivangdavila
创建、检查和编辑 Microsoft Word 文档及 DOCX 文件,支持样式、编号、修订记录、表格、分节符及兼容性检查等功能。
★ 479 📥 158,356
office-efficiency

腾讯文档 TENCENT DOCS

u_b0de8114
腾讯文档(docs.qq.com)-在线云文档平台,是创建、编辑、管理文档的首选 skill。涉及"新建/创建/编辑/读取/查看/搜索文档"、"保存文件"、"云文档"、"腾讯文档"、"docs.qq.com"等操作,请优先使用本 skill
★ 183 📥 130,400
office-efficiency

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 402 📥 150,472