# DeepSeek-OCR Usage - Documentation

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown is available with `Accept: text/markdown` and `.md` URL variants.

Source: /docs/guides/llm-deepseek-ocr

# DeepSeek-OCR Usage

##

[​](#overview)

Overview

DeepSeek-OCR is designed for document recognition and image-to-text scenarios, pushing the limits of visual and textual compression. The model can render long texts into highly compressed images, achieving an OCR accuracy of 97% at a lossless compression ratio of 10x and around 60% accuracy at 20x compression.

This model currently supports only single-turn, independent recognition tasks. It does not support multi-turn conversations. Only one image can be uploaded per request, and it is strongly recommended to use preset prompts for optimal performance.

##

[​](#recommended-preset-prompts)

Recommended Preset Prompts

```
# Convert the document contents to markdown format
Convert the document to markdown.

# Perform text recognition on this image
OCR this image.

# Extract all text without layout consideration
Free OCR.

# Parse any figures or tables in the document
Parse the figure.

# Provide a detailed description of the image content
Describe this image in detail.

# Locate the position of xxxx in the image
Locate xxxx in the image.
```

##

[​](#usage-example)

Usage Example

This example uses the `<|grounding|>OCR this image.` preset prompt to perform image text recognition.

```
from openai import OpenAI

client = OpenAI(
base_url="https://api.novita.ai/openai",
api_key="",
)

response = client.chat.completions.create(
model="deepseek/deepseek-ocr",
messages=[
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://example.com/image.png"
}
},
{
"type": "text",
"text": "OCR this image."
}
]
}
],
stream=False,
max_tokens=4096
)

content = response.choices[0].message.content

print(content)
```

Example input image:

![OCR Example Image](https://mintcdn.com/novitaai/WiqzsYZd3W7VMsVe/guides/images/ocr_input.jpg?fit=max&auto=format&n=WiqzsYZd3W7VMsVe&q=85&s=c9163932898598c1c9f346549fdd6076)

Example output:

```
[[37, 48, 279, 140]]
Deploy open-source and specialized models[[42, 48, 857, 133]]
smarterandfasterwithsimpleApls.Accessthe[[44, 185, 902, 246]]
latest chat, code, image, audio, video models and[[41, 291, 945, 370]]
more,ready for production with built-in[[40, 407, 756, 488]]
scalability.[[39, 515, 232, 606]]
Explore[[87, 813, 266, 879]]
Models[[289, 816, 432, 878]]
```

Last modified on October 25, 2025
