DeepSeek API OCR: extracting text from images with V4 Pro

DeepSeek V4 Pro accepts images, so it can read text from screenshots and scans. Python code, a JSON mode, accuracy checks and a cost calculation for 1,000 pages.

5 min · · автоматизация · API keys

If you need DeepSeek API OCR, meaning text recognition on images through DeepSeek, start with a caveat. The Zukko catalogue has no dedicated OCR model: of the DeepSeek line, deepseek-v4-pro takes images as input, an ordinary multimodal model to which you send a picture and ask for text or JSON. The deepseek-v4.1-flash and deepseek-v4-flash models do not accept images. Below: Python code, structured output, accuracy checks, limits and cost.

DeepSeek API OCR: what is actually available

From the catalogue as of October 18, 2026 (prices in $ per 1M tokens):

ModelInput / outputImage inputContextIndex
deepseek-v4-pro0.075 / 0.225yes1M36
deepseek-v4.1-flash0.013 / 0.038no1M39
deepseek-v4-flash0.025 / 0.063no1M35

The index is the Intelligence Index from Artificial Analysis; it is general, not "for text recognition", so OCR quality on your documents must be checked separately. Since "deepseek vision api" and "deepseek ocr api" are often searched as the same thing, to be precise: through Zukko you work with deepseek-v4-pro as a general-purpose model, not with a specialized OCR model. Other catalogue models with image support (for example qwen3.8-max, claude-sonnet-5-5) can be used too, and we compare cost below. More on the model itself: DeepSeek V4 Pro through the API.

A simple request: image to text

Zukko accepts images in the OpenAI format (/v1/chat/completions): the picture is passed as part of content as a data URL. More on the method: chat completions.

bash
import base64
import mimetypes
from pathlib import Path
from openai import OpenAI

client = OpenAI(base_url="https://api.zukko.pro/v1", api_key="fetch_your_key")

def to_data_url(path: str) -> str:
    mime = mimetypes.guess_type(path)[0] or "image/png"
    b64 = base64.b64encode(Path(path).read_bytes()).decode()
    return f"data:{mime};base64,{b64}"

def ocr(path: str) -> str:
    r = client.chat.completions.create(

The usage line is there to learn how many tokens your picture takes: it depends on image size and on the model, and we take no fixed figures. Run the code on a few typical pages and write down the real values.

Not text but JSON: an invoice, a receipt, a form

Often you need fields rather than "just text". Ask for a structure and check it in code:

bash
import json

PROMPT_JSON = """The image is an invoice. Return only JSON with no explanations in this format:
{"number": string or null, "date": "YYYY-MM-DD" or null, "total": number or null,
 "items": [{"name": string, "qty": number, "price": number}]}
If a field is not visible, use null. Do not invent anything."""

def parse_json(text: str) -> dict:
    text = text.strip()
    if text.startswith("`" * 3):
        text = text.strip("`").removeprefix("json").strip()
    return json.loads(text)

def extract_invoice(path: str) -> dict:

Here we ask the model for JSON in plain prompt text, and the code handles possible code fences around it. Other ways to get a strictly structured answer are in structured JSON output.

How to check accuracy

OCR errs quietly: an "8" instead of a "3" looks like a plausible number. What helps:

  1. Arithmetic checks. The line items must add up to the total (the _sum_ok flag above), and VAT must reconcile with the amount.
  2. Field formats. Dates, tax IDs and invoice numbers are checked with regular expressions or checksums.
  3. A second pass. If two runs of one image, or of two models, disagree, send the document to a person.
  4. Source quality. Small print on a heavily compressed picture reads badly: supply pages at sufficient resolution, crop margins and rotate scans.
  5. Spot checks by a person. Take 30-50 documents, compare them by hand and estimate the error rate on your own data.

The results of your own check will be the only real measure of quality. We quote no accuracy percentages because we have no measurements of our own on your documents.

Limits of vision requests

  • The model must accept images. In the models table this is the "image input" column. Do not send images to models marked "no".
  • Size and format. Allowed formats and maximum size depend on the model's provider. A request that is too large returns 413: shrink the image or split the document into pages.
  • PDF. For a PDF, turn pages into pictures first, as in how to recognize a PDF with AI.
  • Personal data. Pass passports, medical and banking documents only if you have the right to, and do not write the content of such requests to shared logs.

A neural model or classic OCR

For clean printed text of good quality, classic OCR such as Tesseract is enough: it runs locally with no per-request charge. A model with image input wins where structure and meaning matter: tables, invoices, receipts, mixed layouts, extracting fields straight into JSON. A practical option is to run part of your documents both ways and compare, keeping cost in mind.

What it costs

Formula: cost = input × input price / 1,000,000 + output × output price / 1,000,000. Assumption for the example (measure it on your pages via usage): per page 1,600 input tokens (image and instruction) and 600 output tokens. For 1,000 pages: input 1.6M, output 0.6M.

  • deepseek-v4-pro (0.075 / 0.225): 1.6 × $0.075 + 0.6 × $0.225 = $0.12 + $0.135 = $0.255. At official prices (0.66 / 1.98): 1.6 × $0.66 + 0.6 × $1.98 = $1.056 + $1.188 = $2.244.
  • qwen3.8-max (0.088 / 0.238): 1.6 × $0.088 + 0.6 × $0.238 = $0.1408 + $0.1428 = $0.2836.
  • claude-sonnet-5-5 (0.4 / 2): 1.6 × $0.4 + 0.6 × $2 = $0.64 + $1.20 = $1.84.

The number of tokens per image may differ between models, so compare on real usage rather than on these assumptions. Cache is not included. Current prices: GET https://api.zukko.pro/v1/models or the "Models" page in the dashboard. For bulk processing set a daily dollar limit on the key on the API keys page so a bug in a loop does not drain the balance. The dollar balance is topped up from $1: SBP (the payment page adds 8.5% on top), crypto or a MasterCard card.

FAQ

Does DeepSeek have a separate OCR model in Zukko?

No. In the catalogue deepseek-v4-pro takes images, an ordinary multimodal model. There is no dedicated OCR model in the list.

Does deepseek-v4.1-flash accept images?

No, it and deepseek-v4-flash are marked "no" in the image input column of the models table. For images use deepseek-v4-pro or another model with image support.

How do I send a PDF?

Turn the PDF pages into images and send them one at a time or in groups, as described in the article on PDFs.

How accurately is handwriting recognized?

We have not measured it and do not promise accuracy. Check on a sample of your documents and set up field checks.

zukko

Pay 25×
less

for Claude Code & ChatGPT

One fetch_* key and base URL api.zukko.pro — for Cursor, Claude Code, Codex, and any SDK.

Get API keyDocumentation

api.zukko.pro · fetch_*

DeepSeek API OCR: text and JSON from images · Zukko