Skip to main content
POST
/
paas
/
v4
/
files
/
ocr
OCR 服务
curl --request POST \
  --url https://open.bigmodel.cn/api/paas/v4/files/ocr \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form tool_type=hand_write \
  --form language_type=CHN_ENG \
  --form probability=true \
  --form file=@example-file
{
  "task_id": "ce2641ced3e34e67b47f3b0feeb25aee",
  "message": "成功",
  "status": "succeeded",
  "words_result_num": 4,
  "words_result": [
    {
      "location": {
        "left": 79,
        "top": 122,
        "width": 1483,
        "height": 182
      },
      "words": "你好,世界!",
      "probability": {
        "average": 0.7320847511,
        "variance": 0.08768635988,
        "min": 0.3193874359
      }
    }
  ]
}

Authorizations

Authorization
string
header
required

使用以下格式进行身份验证:Bearer <your api key>

Body

multipart/form-data
file
file
required

待识别的图片文件(如 JPG、PNG)

tool_type
enum<string>
required

OCR识别工具类型,可选 hand_write(手写体识别)

Available options:
hand_write
language_type
enum<string>

语言/识别模型类型,可选 CHN_ENG等

Available options:
CHN_ENG,
AUTO,
ENG,
JAP,
KOR,
FRE,
SPA,
POR,
GER,
ITA,
RUS,
DAN,
DUT,
MAL,
SWE,
IND,
POL,
ROM,
TUR,
GRE,
HUN,
THA,
VIE,
ARA,
HIN
probability
boolean
default:false

是否返回置信度(概率)信息。true 为返回

Example:

true

Response

结果获取成功

task_id
string
required

OCR识别任务ID

Example:

"ce2641ced3e34e67b47f3b0feeb25aee"

message
string
required

结果状态描述

Example:

"成功"

status
enum<string>
required

任务处理状态

Available options:
succeeded,
failed
Example:

"succeeded"

words_result_num
integer
required

识别到的文本块/行数

Example:

4

words_result
object[]

每个识别文本块/行的详细结果