跳转到主要内容
POST
/
v1
/
ocr
OCR
curl --request POST \
  --url https://api.example.com/v1/ocr

概览

OCR 端点从文档和图像中提取文本,并返回干净的 Markdown 文本。由 Mistral 的 OCR 模型提供支持。 **支持的格式:**PDF、PNG、JPEG、WebP

快速开始

curl -X POST https://api.dedaluslabs.ai/v1/ocr \
  -H "Authorization: Bearer $DEDALUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistral-ocr-latest",
    "document": {
      "type": "document_url",
      "document_url": "https://arxiv.org/pdf/1706.03762"
    }
  }'
对于本地文件,请编码为 base64 数据 URI 格式:data:application/pdf;base64, {base64_data}

响应

{
  "pages": [
    {
      "index": 0,
      "markdown": "# Attention Is All You Need\n\nAshish Vaswani, Noam Shazeer...\n\n# Abstract\n\nThe dominant sequence transduction models..."
    },
    {
      "index": 1,
      "markdown": "## 1 Introduction\n\nRecurrent neural networks..."
    }
  ],
  "model": "mistral-ocr-latest"
}

应用场景

发票处理

从发票中提取逐项明细、总金额和日期,用于自动记账。

收据扫描

解析收据,实现费用跟踪——将金额、商户、日期等信息提取为结构化文本。

文档数字化

将扫描的文档转换为可搜索、可编辑的 Markdown,同时保留表格和排版格式。

参数

参数类型必填描述
modelstringOCR 模型。默认值:mistral-ocr-latest
document.typestring固定为 document_url
document.document_urlstringHTTPS URL 或 data URI

限制

  • **最大文件大小:**50 MB
  • **最大页数:**每个文档最多 1,000 页
  • **超时时间:**120 秒