OCR-based invoice and receipt recognition using the iFlytek (科大讯飞) API. Extracts structured fields from photos or scans of Chinese invoices and bills.
XFYUN_APP_ID — Application IDXFYUN_API_KEY — API KeyXFYUN_API_SECRET — API Secretpng, jpg/jpeg, bmp, gif, tif/tiff, pdf
The script is at scripts/invoice.py relative to this skill directory.
python3 scripts/invoice.py /path/to/invoice.png
| Flag | Description |
|---|---|
| ------ | ------------- |
--raw | Output raw API JSON response instead of formatted text |
# 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
Human-readable structured fields:
票据类型: 增值税普通发票
发票代码: 012345678901
发票号码: 12345678
开票日期: 2026年03月06日
金额: ¥1,234.56
...
Full API JSON response including all metadata and encoded payload.
Uses HMAC-SHA256 signature-based auth (讯飞鉴权). The script handles all signing automatically — just set the three environment variables.
POST https://api.xf-yun.com/v1/private/sc45f0684| Code | Meaning |
|---|---|
| ------ | --------- |
| 0 | Success |
| 10105 | Unauthorized app or invalid signature |
| 10110 | Missing required field |
| 10163 | Request body too large |
| 10200 | Image read failed |
| 11200 | Quota exceeded |
共 1 个版本