Tencent Cloud General Invoice Recognition (Advanced Edition): Calling VatInvoiceOCR in Agents for Full-Field Invoice Recognition

Introduction

In financial and tax processes, reimbursement, and reconciliation workflows, invoices often appear as photos, scanned images, or PDFs. To reliably obtain structured fields (code, number, buyer/seller, tax amount, line items, etc.) within programs or conversational Agents, the common approach involves manually writing SDK calls and parsing the returned parameters. Tencent Cloud’s OCR team has encapsulated VatInvoiceOCR (General Invoice Recognition Advanced) as the SkillHub skill @tencent-adm/tencentcloud-ocr-vatinvoice. This allows Agents to follow the SKILL.md guidelines to call the official interface for needs such as “invoice recognition,” “full field extraction,” and “PDF processing,” rather than starting from scratch every time.

Below, we introduce the positioning, capabilities, and installation methods of this Skill, along with reproducible script calling examples.

What is this

Tencent Cloud General Invoice Recognition (Advanced) is an OCR calling skill designed for Agents. It is located at @tencent-adm/tencentcloud-ocr-vatinvoice. The current SkillHub version is 1.0.3, the source is enterprise, the category is professional, and it is published by the Tencent Cloud OCR Team. The page is marked with requires_api_key=true, meaning Tencent Cloud API keys must be configured before use.

The skill encapsulates the Tencent Cloud OCR VatInvoiceOCR interface. This skill should be used when full-field information needs to be recognized for VAT special invoices, VAT general invoices, electronic VAT special invoices, electronic VAT general invoices, electronic invoices (general/special VAT), etc. For interface documentation, see Tencent Cloud Documentation.

SkillHub display data (based on page scraping): Rating 100000, Downloads 2664, Installs 197.

Core Functions

Combining the SkillHub introduction and the skill package SKILL.md (consistent with the skill of the same name in the publisher’s repository TencentCloud/tencentcloud-ocr-skills), the verified capabilities include:

  1. Multi-type Full-field Recognition: Covers VAT special/general invoices, electronic special/general invoices, fully digitalized electronic invoices, etc.; supports invoice code, invoice number, issue date, total amount, check code, tax rate, total tax amount, total price and tax, buyer/seller information, and detailed line items.
  2. Structured Output: By default, outputs JSON grouped in Chinese (basic invoice info, buyer/seller, amounts, personnel, line items, etc.); adding --raw retrieves the original structures such as VatInvoiceInfos and Items.
  3. PDF: Enables PDF recognition via IsPdf, and allows specifying page numbers with PdfPageNumber.
  4. Input Methods: ImageUrl and ImageBase64 are mutually exclusive; if both are provided, only ImageUrl is used.
  5. Business-side Constraints (Interface layer): Encoded size must not exceed 10M; pixel dimensions must be between 20–10000px; supports PNG/JPG/JPEG/PDF; default request frequency limit is 10 times/second; recognizing PDFs requires explicitly setting IsPdf=true.

Installation and Activation

1. Install SkillHub CLI (if not already installed)

Check or install according to the SkillHub installation instructions:

command -v skillhub && skillhub --version

If not installed, you can execute:

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash

2. Install this skill to the current Agent’s skills directory

During installation, you must use --dir to point to the skills directory recognized by your current client; otherwise, installing to the default ./skills/ might prevent it from being loaded. Common path examples:

  • Cursor: ~/.cursor/skills/
  • Claude Code: ~/.claude/skills/
  • Codex: ~/.codex/skills/ or .agents/skills/ under the project
skillhub install @tencent-adm/tencentcloud-ocr-vatinvoice --dir ~/.cursor/skills/

You can also provide the following prompt to an AI to let it complete the installation based on the documentation:

Please install `@tencent-adm/tencentcloud-ocr-vatinvoice` according to https://skillhub.cn/install/skillhub.md.

3. Environment and Keys

The skill script depends on Python 3.6+ and tencentcloud-sdk-python:

pip install tencentcloud-sdk-python

Configure in your environment:

  • TENCENTCLOUD_SECRET_ID: Tencent Cloud API Key ID
  • TENCENTCLOUD_SECRET_KEY: Tencent Cloud API Key Key

After installing the skill, you can find SKILL.md and scripts/main.py in the corresponding skills directory. The Agent can trigger and pass arguments according to SKILL.md.

Typical Usage

Run scripts/main.py within the skill directory to complete recognition (examples from the official SKILL.md).

Via Image URL:

python scripts/main.py --image-url "https://example.com/invoice.jpg"

Via Local File (automatically Base64 encoded):

python scripts/main.py --image-base64 ./invoice.jpg

PDF Invoice (PDF mode must be enabled):

python scripts/main.py --image-base64 ./invoice.pdf --is-pdf

Specify PDF page number, output raw JSON, specify region:

python scripts/main.py --image-base64 ./invoice.pdf --is-pdf --pdf-page-number 2
python scripts/main.py --image-url "https://example.com/invoice.jpg" --raw
python scripts/main.py --image-url "https://example.com/invoice.jpg" --region ap-beijing

In clients like Cursor or Claude Code, when a user describes in natural language “Recognize this invoice and list the details,” the Agent should read SKILL.md (assuming the skill is installed) and then call the above script or equivalent SDK logic.

Use Cases and Notes

Suitable for: Reimbursement automation, invoice ledger entry, field extraction before reconciliation, structured OCR requiring line items (goods/services list), PDF layout invoice recognition.

Notes:

  1. This is a billable capability of Tencent Cloud; you need to activate the VAT invoice recognition service. Error codes include insufficient balance, resource package exhaustion, service not activated, etc., which need to be investigated in the console and billing side.
  2. IsPdf defaults to false; for PDFs, --is-pdf must be explicitly set.
  3. Blurry, empty, or oversized images will trigger errors listed in the documentation such as FailedOperation.*. Ensure material quality and size limits.
  4. Officially recommended to store images in Tencent Cloud COS for better download speed and stability (see SKILL.md business notes).
  5. The skill label requires an API Key; do not write SECRET_ID / SECRET_KEY into repositories or conversation logs.

Conclusion

@tencent-adm/tencentcloud-ocr-vatinvoice consolidates the invoice types covered, field lists, PDF parameters, and script entries of VatInvoiceOCR into a standard Skill form, making it suitable for full-field invoice recognition within Agent workflows. Installation and priority source configuration are subject to the SkillHub documentation; for skill details and API instructions, see:

  • SkillHub: https://www.skillhub.cn/skills/tencent-adm/tencentcloud-ocr-vatinvoice
  • Official Entry: https://api.skillhub.cn/tencent-adm/tencentcloud-ocr-vatinvoice
  • Tencent Cloud VatInvoiceOCR: https://cloud.tencent.com/document/api/866/36210
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye