Image Information Extraction

Upload an image and a prompt, and get the structured extraction result.

POST/v1/ocr/image/extract

Authorization

AuthorizationstringheaderRequired
HTTP: Bearer Auth
  • Security Scheme Type: http
  • HTTP Authorization Scheme: Bearer API_key,Used to verify account information, can be viewed in Project Management > API Key .

Request Header

Content-Typeenum<string>Default:multipart/form-dataRequired

Request body is form data. Usemultipart/form-datato upload fields and file.

Available options:multipart/form-data

Request Bodymultipart/form-data

model string Required

Model ID. Current available value:u1-ocr-extract

sceneenum<string>

Specify different scenes. Values and use cases are as follows (default: general).
  • generalGeneral scene (invoice/receipt/reimbursement/cost list extraction and reconciliation).
  • medicalMedical scene (medical records/test reports/prescriptions/cost statements/charge lists and detailed expense document-card verification).

image file Required

Image file to be extracted.

  • Supported formats: JPG, JPEG, PNG, BMP
  • Size limit: ≤ 10MB

prompt string Required

Prompt used to guide the model to extract specific information.

Example:Please extract the information from the image using the following schema: {"invoice_no":"Invoice Number","date":"Invoice Date","items":[{"name":"Item Name","total":"Amount"}]}

Response Body Structure

contentstring

Text content returned by the model.

usageobject

Token usage statistics.

usage.prompt_tokensinteger

Input token count

usage.completion_tokensinteger

Output token count

usage.total_tokensinteger

Total token count

base_respobject

Status code and details of this request

base_resp.status_codeinteger

Status codes:
  • 0, Success
  • 100001, Missing required
  • 261001, Invalid image format. Only JPG, JPEG, PNG, BMP are supported
  • 261002, Image size exceeds 10MB limit
  • 261003, Image corrupted or cannot be parsed
  • 261101, Upstream model timeout
  • 261999, Internal system error

base_resp.status_msgstring

Status message. "success" when status_code=0, otherwise the error reason.