ocr_image

ocr_image只读扩展
OCR 图片(服务端,需图片 URL 或已缓存的图片 file_id)
别名:.ocr_image

通过 POST http://127.0.0.1:3000/ocr_image(请求体为 JSON 参数)或 WebSocket 调用。

输入参数

参数 类型 必填 默认 说明
image string

返回 (data)

{ texts, language }:识别文本数组(含置信度与坐标)与识别语言。

所有响应都包裹在标准信封中:{ "status": "ok", "retcode": 0, "data": ... }。下表描述 data 字段。

字段 类型 必填 说明
texts object[] 识别出的文本块
language string 识别语言
原始 JSON Schema
{
  "type": "object",
  "properties": {
    "texts": {
      "type": "array",
      "description": "识别出的文本块",
      "items": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string",
            "description": "文本内容"
          },
          "confidence": {
            "type": "number",
            "description": "置信度"
          },
          "coordinates": {
            "type": "array",
            "description": "文本框顶点坐标",
            "items": {
              "type": "object",
              "properties": {
                "x": {
                  "type": "number",
                  "description": "X 坐标"
                },
                "y": {
                  "type": "number",
                  "description": "Y 坐标"
                }
              },
              "required": [
                "x",
                "y"
              ]
            }
          }
        },
        "required": [
          "text",
          "confidence",
          "coordinates"
        ]
      }
    },
    "language": {
      "type": "string",
      "description": "识别语言"
    }
  },
  "required": [
    "texts",
    "language"
  ]
}

调用示例

curl
Python
JavaScript
Go
SnowLuma SDK
curl -X POST http://127.0.0.1:3000/ocr_image \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <access-token>' \
  -d '{"image":""}'
在用 AI 助手?

支持 MCP 的客户端可直接发现并调用本动作,无需手写 HTTP。见 MCP 接入