Files
wehub-resource-sync e904b667c6
Build/Publish Develop Docs / deploy (push) Failing after 1s
PaddleOCR Code Style Check / check-code-style (push) Failing after 1s
PaddleOCR PR Tests GPU / detect-changes (push) Failing after 1s
PaddleOCR PR Tests / detect-changes (push) Failing after 1s
PaddleOCR PR Tests GPU / test-pr-gpu (push) Has been cancelled
PaddleOCR PR Tests / test-pr (push) Has been cancelled
PaddleOCR PR Tests GPU / test-pr-gpu-impl (push) Has been cancelled
PaddleOCR PR Tests / test-pr-python (3.13) (push) Has been cancelled
PaddleOCR PR Tests / test-pr-python (3.8) (push) Has been cancelled
PaddleOCR PR Tests / test-pr-python (3.9) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:59:26 +08:00
..

PaddleOCR Go SDK

English | 简体中文

Go client for the PaddleOCR official API. It submits OCR and document parsing jobs to hosted PaddleOCR services; it does not run local PaddleOCR inference or load local models.

Official user docs:

Install

go get github.com/PaddlePaddle/PaddleOCR/api_sdk/go

Versioned releases use submodule tags such as api_sdk/go/v0.1.0.

Minimal Usage

Set PADDLEOCR_ACCESS_TOKEN or pass WithToken when constructing the client:

export PADDLEOCR_ACCESS_TOKEN="your-access-token"
client, err := paddleocr.NewClient()
if err != nil {
	return err
}

result, err := client.OCR(ctx, &paddleocr.OCRRequest{
	Model:   paddleocr.PPOCRv5,
	FileURL: "https://example.com/invoice.pdf",
})
if err != nil {
	return err
}
fmt.Println(result.JobID, len(result.Pages))

Set Model: paddleocr.PPOCRv6 (or "PP-OCRv6") to use the PP-OCRv6 hosted OCR model. Set Model: paddleocr.PPOCRv5Latin (or "PP-OCRv5-latin") to use the PP-OCRv5 Latin-script hosted OCR model.

Document parsing defaults to PaddleOCR-VL-1.6:

doc, err := client.ParseDocument(ctx, &paddleocr.DocParsingRequest{
	FilePath: "./report.pdf",
	Options: &paddleocr.PaddleOCRVLOptions{
		UseChartRecognition: paddleocr.Bool(true),
	},
})
if err != nil {
	return err
}
fmt.Println(doc.JobID, len(doc.Pages))

Build And Test

go test ./...
go vet ./...
go test -race ./...

go test -race ./... is recommended before public release.