A self-hosted OCR API powered by DeepSeek-OCR-2.
10K+
Self-hosted OCR API powered by DeepSeek-OCR-2. Process PDFs and images, get clean markdown output via REST API.
Create docker-compose.yml:
services:
deepseek-ocr2:
image: edgaras0x4e/deepseek-ocr-2-api:latest
container_name: deepseek-ocr2
ports:
- "9713:7860"
volumes:
- ocr-data:/data
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
restart: unless-stopped
volumes:
ocr-data:
Run:
docker compose up -d
The API will be available at http://localhost:9713. Model (~6.4GB) downloads on first startup.
Submit a document:
curl -X POST http://localhost:9713/ocr -F "[email protected]"
Response:
{
"job_id": "abc123...",
"filename": "document.pdf",
"status": "queued"
}
Check status:
curl http://localhost:9713/ocr/{job_id}
Get results:
curl http://localhost:9713/ocr/{job_id}/result
Returns markdown text for each page.
| Method | Endpoint | Description |
|---|---|---|
POST | /ocr | Upload PDF or image |
GET | /ocr/{job_id} | Get job status |
GET | /ocr/{job_id}/pages/{page_num} | Get specific page |
GET | /ocr/{job_id}/result | Get all pages |
POST | /ocr/{job_id}/cancel | Cancel job |
DELETE | /ocr/{job_id} | Delete job |
GET | /jobs | List all jobs |
GET | /health | API health check |
Environment variables:
environment:
- API_KEY=your-secret-key
- OCR_DPI=300
- DB_PATH=/data/ocr.db
- UPLOAD_DIR=/data/uploads
MIT
Content type
Image
Digest
sha256:d6b334983…
Size
6.9 GB
Last updated
6 months ago
docker pull edgaras0x4e/deepseek-ocr-2-api