← 返回 Skills 市场
upstage-deployment

Upstage Ocr

作者 Upstage Deployment · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
32
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install upstage-ocr
功能描述
Extract plain text with word-level bounding box coordinates from images and scanned documents using Upstage OCR API. Use when user asks to OCR a document, ex...
使用说明 (SKILL.md)

Upstage OCR

Extract word-level text with bounding box coordinates from images and scanned documents.

Quick Start

import os
import requests

response = requests.post(
    "https://api.upstage.ai/v1/document-digitization",
    headers={"Authorization": f"Bearer {os.environ['UPSTAGE_API_KEY']}"},
    files={"document": open("scan.pdf", "rb")},
    data={"model": "ocr"}
)
result = response.json()
print(result["pages"][0]["text"])

API Key: Always use os.environ["UPSTAGE_API_KEY"]. Get your key at console.upstage.ai.


Endpoints

Mode Endpoint Max pages Max file size
Sync POST /v1/document-digitization 100 50 MB
Async POST /v1/document-digitization/async 1000 50 MB
  • Request format: multipart/form-data
  • Sync: returns the result in the response body (timeout 5 min).
  • Async: returns a request_id; poll status and download per-batch results (batches of 10 pages).

Parameters

Parameter Type Required Description
model string Yes ocr (alias: ocr-250904)
document file Yes Document file to process
schema string No clova or google (for migration)

Limits

Item Sync Async
Max pages 100 1000
Max file size 50 MB 50 MB
Max pixels/page 200,000,000 200,000,000

Pick sync for ≤ 100 pages and quick (≤ 5 min) processing. Pick async for documents up to 1000 pages, when you can poll, or when the sync timeout would be hit.

Supported Formats

JPEG, PNG, BMP, PDF, TIFF, HEIC, DOCX, PPTX, XLSX, HWP, HWPX

Supported Languages

  • Full support: Alphabets, Korean, Chinese characters
  • Partial support: Katakana, Hiragana
  • Beta: Simplified Chinese

Response Structure

{
  "api": "2.0",
  "model": "ocr-250904",
  "pages": [
    {
      "id": 0,
      "text": "Full extracted text",
      "words": [
        {
          "id": 0,
          "text": "word",
          "bounding_box": {
            "vertices": [
              {"x": 0.12, "y": 0.05},
              {"x": 0.25, "y": 0.05},
              {"x": 0.25, "y": 0.08},
              {"x": 0.12, "y": 0.08}
            ]
          },
          "confidence": 0.98
        }
      ]
    }
  ],
  "usage": {"pages": 1}
}

Usage Examples

Sync — Basic OCR

curl -X POST "https://api.upstage.ai/v1/document-digitization" \
  -H "Authorization: Bearer $UPSTAGE_API_KEY" \
  -F "document=@/path/to/image.jpg" \
  -F "model=ocr"

Sync — Python (Extract Text with Coordinates)

import os
import requests

def ocr_document(file_path):
    with open(file_path, "rb") as f:
        response = requests.post(
            "https://api.upstage.ai/v1/document-digitization",
            headers={"Authorization": f"Bearer {os.environ['UPSTAGE_API_KEY']}"},
            files={"document": f},
            data={"model": "ocr"}
        )
    result = response.json()

    for page in result["pages"]:
        print(f"=== Page {page['id']} ===")
        print(page["text"])
        for word in page["words"]:
            print(f"  [{word['confidence']:.2f}] {word['text']} @ {word['bounding_box']}")

    return result

Async — Submit, Poll, Download

Use the async endpoint for documents up to 1000 pages. Documents are processed in batches of 10 pages; results are stored for 30 days, individual download URLs expire after 15 minutes.

# 1. Submit
curl -X POST "https://api.upstage.ai/v1/document-digitization/async" \
  -H "Authorization: Bearer $UPSTAGE_API_KEY" \
  -F "[email protected]" \
  -F "model=ocr"
# → {"request_id": "uuid-here"}

# 2. Poll status
curl "https://api.upstage.ai/v1/document-digitization/requests/{request_id}" \
  -H "Authorization: Bearer $UPSTAGE_API_KEY"

Status values: submitted, started, completed, failed (check failure_message). The completed response includes a download_url per batch — fetch each and concatenate pages to reconstruct the full document.

import os
import time
import requests

api_key = os.environ["UPSTAGE_API_KEY"]
base = "https://api.upstage.ai/v1/document-digitization"

with open("large.pdf", "rb") as f:
    r = requests.post(
        f"{base}/async",
        headers={"Authorization": f"Bearer {api_key}"},
        files={"document": f},
        data={"model": "ocr"},
    )
request_id = r.json()["request_id"]

while True:
    status = requests.get(
        f"{base}/requests/{request_id}",
        headers={"Authorization": f"Bearer {api_key}"},
    ).json()
    if status["status"] == "completed":
        break
    if status["status"] == "failed":
        raise RuntimeError(status.get("failure_message", "unknown failure"))
    time.sleep(5)

# status["batches"] contains per-batch download_url entries
pages = []
for batch in status.get("batches", []):
    data = requests.get(batch["download_url"]).json()
    pages.extend(data["pages"])

Output Files

  • Default: write to \x3Csystem-temp>/\x3Cinput-stem>.ocr.json (e.g., /tmp/receipt.ocr.json). Use tempfile.gettempdir() for cross-platform code.
  • Override: if the user specifies an output path, use it.
  • Always print the resolved absolute path in your response so the user can locate the file.

Tips

  • For documents > 100 pages, switch to the async endpoint (up to 1000 pages). Sync rejects oversized documents.
  • Sync server timeout is 5 minutes — if a sync request times out, retry on /async.
  • Async results live for 30 days; per-batch download_urls expire after 15 minutes (re-fetch status to refresh).
  • Low scan quality will result in lower confidence values. Pre-processing images can help.
  • Coordinates are returned as normalized ratios (0–1).
  • OCR extracts text only. If you need structured HTML/Markdown output, use Document Parse instead.
安全使用建议
This looks safe to install if you intend to use Upstage's cloud OCR service. Before using it, set UPSTAGE_API_KEY carefully, avoid submitting documents you cannot share with Upstage, and remember that OCR output may be written to a temp file or a path you specify.
功能分析
Type: OpenClaw Skill Name: upstage-ocr Version: 1.0.0 The skill bundle provides standard instructions and code snippets for interacting with the legitimate Upstage OCR API. It uses environment variables for API keys and follows safe practices for file handling by using system temporary directories (SKILL.md).
能力标签
requires-sensitive-credentials
能力评估
Purpose & Capability
The stated purpose, examples, and endpoint usage are coherent: the skill is for OCR text extraction with word-level coordinates using Upstage's document digitization API.
Instruction Scope
The instructions are scoped to OCR requests and include output handling, but users should be aware the examples upload the selected document to an external API.
Install Mechanism
No install spec or code files are present; this is an instruction-only skill with no package installation or hidden helper code shown.
Credentials
The skill requires an Upstage API key via UPSTAGE_API_KEY and external network calls, which are expected for this integration, but the registry metadata lists no required environment variables or primary credential.
Persistence & Privilege
The visible instructions describe writing OCR output to a temp file or user-specified path and note that async results are stored by Upstage for 30 days; no background persistence or elevated local privileges are shown.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install upstage-ocr
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /upstage-ocr 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of upstage-ocr. - Extract plain text and word-level bounding box coordinates from images and scanned documents using the Upstage OCR API. - Supports synchronous (≤100 pages) and asynchronous (≤1000 pages) processing. - Handles a wide range of formats including JPEG, PNG, BMP, PDF, TIFF, HEIC, DOCX, PPTX, XLSX, HWP, HWPX. - Provides examples for both sync and async workflows with details on file output and usage tips.
元数据
Slug upstage-ocr
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Upstage Ocr 是什么?

Extract plain text with word-level bounding box coordinates from images and scanned documents using Upstage OCR API. Use when user asks to OCR a document, ex... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 32 次。

如何安装 Upstage Ocr?

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

Upstage Ocr 是免费的吗?

是的,Upstage Ocr 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Upstage Ocr 支持哪些平台?

Upstage Ocr 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Upstage Ocr?

由 Upstage Deployment(@upstage-deployment)开发并维护,当前版本 v1.0.0。

💬 留言讨论