Skip to main content

Python SDK

OCR SDK for Python

fastocr-sdk is the Python client for the FastOCR cloud OCR API. Give it a scanned PDF or an image and it returns the text or a searchable PDF, in 100+ languages including Chinese, Japanese, Korean, Arabic and Hebrew. OCR runs in FastOCR's cloud, not on your machine.

MIT licence · Python 3.9+ · fastocr-sdk on PyPI · 50 free pages a month, then from $12.00 per 1,000 pages.

Install and run

Install with pip install fastocr-sdk and put your key in FASTOCR_API_KEY. The import is fastocr_sdk; the unrelated fastocr package on PyPI is a different project.

Extract text from a PDF

from fastocr_sdk import FastOCR

# Reads the key from the FASTOCR_API_KEY environment variable.
with FastOCR() as client:
    text = client.extract_text("scan.pdf")
    print(text)

Make a searchable PDF

from fastocr_sdk import FastOCR

with FastOCR() as client:
    job = client.documents.process("scan.pdf")
    client.documents.download_searchable_pdf(job.id, "searchable.pdf")
    print(job.id, job.status, job.pages_billed)

Async client

import asyncio
from fastocr_sdk import AsyncFastOCR

async def main():
    async with AsyncFastOCR() as client:
        text = await client.extract_text("invoice.pdf")
        print(text)

asyncio.run(main())

The SDK streams large files from disk, retries transient failures and never creates a document twice. Every method and error is in the API docs; for cURL and Node.js see the searchable PDF API.

Cloud OCR SDK vs on-premise OCR SDKs

On-premise SDKs such as ABBYY FineReader Engine or Tesseract run the OCR engine on your own machines. fastocr-sdk is a thin client: the engine is the FastOCR service. Pick by where your documents are allowed to go.

fastocr-sdk (cloud)On-premise OCR SDK
Where OCR runsFastOCR cloud; the SDK uploads the file over HTTPSOn your own servers or devices
Works offlineNoYes
Setuppip install fastocr-sdk and an API keyInstall the engine, language data and licence on each machine
ScalingHandled by the service; limits per accountYour hardware and your queue
Languages100+, detected automatically, including CJK and right-to-leftDepends on the engine and the language packs you install
OutputPlain text or a searchable PDFDepends on the SDK; often more formats and layout data
CostFree pages each month, then prepaid page packsFree open source (Tesseract) or a commercial licence

An ABBYY PDF SDK alternative for cloud apps

If your app already sends files to the cloud, fastocr-sdk replaces an engine install with one package and an API key, and you pay per page. If documents must stay on your network or the app must work offline, an on-premise SDK is the right tool.

OCR SDK with CJK and right-to-left support

There are no language packs to install: the service detects the language. Searchable PDFs carry CJK and right-to-left text layers that copy out correctly. See the measured results.

MCP server: coming soon

fastocr-mcp will let Claude, Cursor and other MCP clients OCR a local PDF or image with your API key. It is built on fastocr-sdk and is not published yet.

Need OCR offline?

FastOCR's free desktop apps make searchable PDFs on your own computer with the operating system's built-in text recognition. They are apps, not SDKs, and support fewer languages than the cloud API: FastOCR for Mac, FastOCR for Windows.

Frequently asked questions

Is there a Python OCR SDK with CJK support?

Yes. fastocr-sdk sends PDFs and images to the FastOCR API, which reads 100+ languages, including Chinese, Japanese and Korean, and detects the language itself. The searchable PDF it returns uses CJK fonts in its text layer, so the text copies out as text.

Is FastOCR an alternative to the ABBYY PDF SDK?

For cloud workloads, yes: you get text and searchable PDFs from scanned PDFs without installing an engine or managing licences. It is not a like-for-like replacement. ABBYY sells on-premise engines that run offline; FastOCR runs in the cloud and needs an internet connection.

Does the FastOCR SDK work offline?

No. The SDK is a client for the cloud API, so documents are uploaded and processed by FastOCR. For offline OCR on a desktop, FastOCR has free Mac and Windows apps that use the operating system's own text recognition.

Is the SDK free?

The SDK is open source under the MIT licence. The API it calls includes free pages: Each account gets 50 free document pages per month.

Which files does the SDK accept?

PDF files up to 1 GiB, streamed from disk, and PNG, JPG, JPEG, GIF, WebP and BMP images up to 20 MiB, one page each. Images need fastocr-sdk 0.2.0 or later.

Get a key and run the quickstart

Any signed-in FastOCR account can create an API key and start right away. Each account gets 50 free document pages per month.