CLI Usage
The Kreuzberg CLI provides command-line access to all extraction features. This guide covers installation, basic usage, and advanced features.
Installation
Section titled “Installation”curl -fsSL https://raw.githubusercontent.com/kreuzberg-dev/kreuzberg-lts/main/scripts/install.sh | bashbrew install kreuzberg-dev/tap/kreuzbergcargo install kreuzberg-clidocker pull ghcr.io/kreuzberg-dev/kreuzberg-cli:latestdocker run -v $(pwd):/data ghcr.io/kreuzberg-dev/kreuzberg-cli:latest extract /data/document.pdfgo get github.com/kreuzberg-dev/kreuzberg-lts/v4@latestHomebrew Installation:
- ✅ Text extraction (PDF, Office, images, 91+ formats)
- ✅ OCR with Tesseract
- ✅ HTTP API server (
servecommand) - ✅ MCP protocol server (
mcpcommand) - ✅ Chunking, quality scoring, language detection
- ❌ Embeddings - Not available via CLI flags. Use config file or Docker image.
Docker Images:
- All features enabled including embeddings (ONNX Runtime included)
Global Flags v4.5.2
Section titled “Global Flags v4.5.2”Log Level v4.5.2
Section titled “Log Level v4.5.2”Control the verbosity of log output with the --log-level flag. This overrides the RUST_LOG environment variable.
# Set log level to debug for troubleshootingkreuzberg --log-level debug extract document.pdf
# Suppress all but error messageskreuzberg --log-level error batch documents/*.pdf
# Trace-level logging for maximum detailkreuzberg --log-level trace extract document.pdfValid levels: trace, debug, info (default), warn, error.
Colored Output
Section titled “Colored Output”Text output is colored by default. To disable colors, set the NO_COLOR environment variable:
# Disable colored outputNO_COLOR=1 kreuzberg extract document.pdfBasic Usage
Section titled “Basic Usage”Extract from Single File
Section titled “Extract from Single File”# Extract text content to stdoutkreuzberg extract document.pdf
# Specify MIME type (auto-detected if not provided)kreuzberg extract document.pdf --mime-type application/pdfBatch Extract Multiple Files
Section titled “Batch Extract Multiple Files”Use the batch command to extract from multiple files:
# Extract from multiple fileskreuzberg batch doc1.pdf doc2.docx doc3.txt
# Batch extract all PDFs in directorykreuzberg batch documents/*.pdf
# Batch extract recursivelykreuzberg batch documents/**/*.pdfExtract Structured Data v4.8.0
Section titled “Extract Structured Data v4.8.0”Use the extract-structured subcommand to pull typed JSON out of a document via an LLM. The CLI extracts the document’s text, hands it to the configured model with a JSON schema constraint, and prints the structured output.
# Extract invoice fields into JSON matching invoice_schema.jsonkreuzberg extract-structured invoice.pdf \ --schema invoice_schema.json \ --model openai/gpt-4o \ --strict| Flag | Description |
|---|---|
<PATH> (positional) |
Document file path. Required. |
--schema <PATH> |
Path to a JSON schema file describing the desired output. Required. |
--model <MODEL> |
LLM model identifier, for example openai/gpt-4o or anthropic/claude-sonnet-4-20250514. Required. |
--api-key <KEY> |
LLM provider API key. Falls back to OPENAI_API_KEY, ANTHROPIC_API_KEY, etc. |
--prompt <TEMPLATE> |
Custom Jinja2 prompt template overriding the built-in one. |
--schema-name <NAME> |
Schema identifier passed to the LLM. Default: extraction. |
--strict |
Enable OpenAI strict mode for exact schema matching. |
-c, --config <PATH> |
Path to a TOML/YAML/JSON extraction config file applied to the document extraction step. |
-f, --format <FORMAT> |
Wire format for the printed output: json (default), text, or toon. |
The structured output is whatever the LLM produced for the schema; the underlying document text is not printed. Set RUST_LOG=kreuzberg=debug to inspect the prompt that was sent.
Output Formats
Section titled “Output Formats”# Output as plain text (default for extract)kreuzberg extract document.pdf --format text
# Output as JSON (default for batch)kreuzberg batch documents/*.pdf --format json
# Extract single file as JSONkreuzberg extract document.pdf --format json
# Output as TOON wire format (token-efficient alternative to JSON)kreuzberg extract document.pdf --format toonContent Output Format
Section titled “Content Output Format”Control the formatting of extracted text content with --content-format (the deprecated alias --output-format is still accepted):
# Extract as plain text (default)kreuzberg extract document.pdf --content-format plain
# Extract as Markdownkreuzberg extract document.pdf --content-format markdown
# Extract as Djot markupkreuzberg extract document.pdf --content-format djot
# Extract as HTMLkreuzberg extract document.pdf --content-format html
# Combine content format with wire formatkreuzberg extract document.pdf --content-format markdown --format toonThe --content-format flag controls how the extracted text is formatted (what goes inside result.content). This is different from --format which controls the wire format used to serialize the entire result (text, json, or toon).
OCR Extraction
Section titled “OCR Extraction”Enable OCR
Section titled “Enable OCR”# Enable OCR (overrides config file setting)kreuzberg extract scanned.pdf --ocr true
# Disable OCRkreuzberg extract document.pdf --ocr falseForce OCR
Section titled “Force OCR”Force OCR even for PDFs with text layer:
# Force OCR to run regardless of existing textkreuzberg extract document.pdf --force-ocr trueOCR Language Selection
Section titled “OCR Language Selection”Set the OCR language using the --ocr-language flag. This flag is backend-agnostic and works with all supported OCR backends (Tesseract, PaddleOCR, EasyOCR).
Language Code Formats:
- Tesseract: Uses ISO 639-3 codes (three-letter codes)
- Examples:
eng(English),fra(French),deu(German),spa(Spanish),jpn(Japanese)
- Examples:
- PaddleOCR: Accepts flexible language codes and full language names
- Examples:
en,ch,french,korean,thai,greek,cyrillic, and so on.
- Examples:
- EasyOCR: Similar flexible format to PaddleOCR
When used with --ocr true, the language flag overrides the default language. When used without --ocr, it overrides the language specified in your config file.
# French OCR with Tesseract (default backend)kreuzberg extract --ocr true --ocr-language fra document.pdf
# Chinese OCR with PaddleOCRkreuzberg extract --ocr true --ocr-backend paddle-ocr --ocr-language ch document.pdf
# Thai OCR with PaddleOCRkreuzberg extract --ocr true --ocr-backend paddle-ocr --ocr-language thai document.pdf
# German OCR with Tesseractkreuzberg extract --ocr true --ocr-language deu document.pdf
# Override config file language with Spanishkreuzberg extract document.pdf --config kreuzberg.toml --ocr-language spaOCR Configuration
Section titled “OCR Configuration”OCR options are configured via config file. CLI flags override config settings:
# Extract with OCR enabled via config filekreuzberg extract scanned.pdf --config kreuzberg.toml --ocr trueConfigure OCR backend, language, and Tesseract options in your config file (see Configuration Files section).
Configuration Files
Section titled “Configuration Files”Using Config Files
Section titled “Using Config Files”Kreuzberg automatically discovers a configuration file by searching the current directory and parent directories for kreuzberg.toml only. If you use YAML or JSON, specify the file explicitly with --config.
# Extract using discovered configuration (finds kreuzberg.toml)kreuzberg extract document.pdfSpecify Config File
Section titled “Specify Config File”You can load TOML, YAML (.yaml or .yml), or JSON via --config:
kreuzberg extract document.pdf --config my-config.tomlkreuzberg extract document.pdf --config kreuzberg.yamlkreuzberg extract document.pdf --config my-config.jsonInline JSON Config
Section titled “Inline JSON Config”Override or supply config without a file using inline JSON (merged after config file, before individual flags):
# Inline JSON (applied after config file)kreuzberg extract document.pdf --config-json '{"ocr":{"backend":"tesseract"},"chunking":{"max_chars":1000}}'
# Base64-encoded JSON (useful in shells where quoting is awkward)kreuzberg extract document.pdf --config-json-base64 eyJvY3IiOnsiYmFja2VuZCI6InRlc3NlcmFjdCJ9fQ==Both extract and batch support --config-json and --config-json-base64.
Example Config Files
Section titled “Example Config Files”kreuzberg.toml:
use_cache = trueenable_quality_processing = true
[ocr]backend = "tesseract"language = "eng"
[ocr.tesseract_config]psm = 3
[chunking]max_characters = 1000overlap = 100kreuzberg.yaml:
use_cache: trueenable_quality_processing: true
ocr: backend: tesseract language: eng tesseract_config: psm: 3
chunking: max_characters: 1000 overlap: 100kreuzberg.json:
{ "use_cache": true, "enable_quality_processing": true, "ocr": { "backend": "tesseract", "language": "eng", "tesseract_config": { "psm": 3 } }, "chunking": { "max_characters": 1000, "overlap": 100 }}Batch Processing
Section titled “Batch Processing”Use the batch command to process multiple files:
# Extract all PDFs in directorykreuzberg batch documents/*.pdf
# Extract PDFs recursively from subdirectorieskreuzberg batch documents/**/*.pdf
# Extract multiple file typeskreuzberg batch documents/**/*.{pdf,docx,txt}Batch with Output Formats
Section titled “Batch with Output Formats”# Output as JSON (default for batch command)kreuzberg batch documents/*.pdf --format json
# Output as plain textkreuzberg batch documents/*.pdf --format textBatch with OCR
Section titled “Batch with OCR”# Batch extract with OCR enabledkreuzberg batch scanned/*.pdf --ocr true
# Batch extract with force OCRkreuzberg batch documents/*.pdf --force-ocr true
# Batch extract with quality processingkreuzberg batch documents/*.pdf --quality trueBatch with Content Format
Section titled “Batch with Content Format”# Batch extract with djot formattingkreuzberg batch documents/*.pdf --output-format djot --format json
# Batch extract as Markdownkreuzberg batch documents/*.pdf --output-format markdown --format json
# Batch extract as HTMLkreuzberg batch documents/*.pdf --output-format html --format jsonAdvanced Features
Section titled “Advanced Features”Language Detection
Section titled “Language Detection”# Extract with automatic language detectionkreuzberg extract document.pdf --detect-language true
# Disable language detectionkreuzberg extract document.pdf --detect-language falseContent Chunking
Section titled “Content Chunking”# Split content into chunks for LLM processingkreuzberg extract document.pdf --chunk true
# Specify chunk size and overlapkreuzberg extract document.pdf --chunk true --chunk-size 1000 --chunk-overlap 100
# Output chunked content as JSONkreuzberg extract document.pdf --chunk true --format jsonQuality Processing
Section titled “Quality Processing”# Apply quality processing for improved formattingkreuzberg extract document.pdf --quality true
# Disable quality processingkreuzberg extract document.pdf --quality false
# Batch extraction with quality processingkreuzberg batch documents/*.pdf --quality trueCaching
Section titled “Caching”# Extract with result caching enabled (default)kreuzberg extract document.pdf
# Extract without caching resultskreuzberg extract document.pdf --no-cache true
# Clear all cached resultskreuzberg cache clear
# View cache statisticskreuzberg cache statsExtraction Override Flags v4.5.2
Section titled “Extraction Override Flags v4.5.2”The extract and batch commands support a comprehensive set of flags to override extraction configuration. These flags take precedence over config file settings.
OCR Flags
Section titled “OCR Flags”| Flag | Description |
|---|---|
--ocr <true|false> |
Enable or disable OCR. Defaults to tesseract backend when enabled. |
--ocr-backend <BACKEND> |
OCR backend: tesseract, paddle-ocr, or easyocr. |
--ocr-language <LANG> |
OCR language code. Tesseract uses ISO 639-3 (eng, fra, deu). PaddleOCR/EasyOCR use short codes (en, ch, korean). |
--force-ocr <true|false> |
Force OCR even if the document has an existing text layer. |
--ocr-auto-rotate <true|false> |
Automatically rotate images before OCR based on detected orientation. |
--disable-ocr <true|false> |
Disable OCR entirely, even for images. |
kreuzberg extract scanned.pdf --ocr true --ocr-backend paddle-ocr --ocr-language chkreuzberg extract document.pdf --force-ocr true --ocr-auto-rotate trueChunking Flags
Section titled “Chunking Flags”| Flag | Description |
|---|---|
--chunk <true|false> |
Enable or disable text chunking. |
--chunk-size <N> |
Maximum chunk size in characters (default: 1000). |
--chunk-overlap <N> |
Overlap between consecutive chunks in characters (default: 200). |
--chunking-tokenizer <MODEL> |
Tokenizer model for token-based chunk sizing (for example Xenova/gpt-4o). Implicitly enables chunking. Requires the chunking-tokenizers feature. |
kreuzberg extract document.pdf --chunk true --chunk-size 512 --chunk-overlap 50kreuzberg extract document.pdf --chunking-tokenizer "Xenova/gpt-4o"Output Flags
Section titled “Output Flags”| Flag | Description |
|---|---|
--content-format <FORMAT> |
Content output format: plain, markdown, djot, or html. Controls how extracted text is formatted. (Deprecated alias: --output-format) |
--include-structure <true|false> |
Include hierarchical document structure in results. |
kreuzberg extract document.pdf --content-format markdown --include-structure trueLayout Detection Flags
Section titled “Layout Detection Flags”| Flag | Description |
|---|---|
--layout |
Enable layout detection with default settings (RT-DETR v2). Use --layout false to explicitly disable. Requires the layout-detection feature. |
--layout-confidence <FLOAT> |
Layout detection confidence threshold (0.0 - 1.0). |
--layout-table-model <MODEL> |
Table structure model: tatr (default), slanet_wired, slanet_wireless, slanet_plus, slanet_auto, disabled. |
kreuzberg extract document.pdf --layout --layout-confidence 0.7Acceleration Flags
Section titled “Acceleration Flags”| Flag | Description |
|---|---|
--acceleration <PROVIDER> |
ONNX Runtime execution provider for model inference: auto, cpu, coreml, cuda, or tensorrt. |
# Use CoreML on macOS for GPU accelerationkreuzberg extract document.pdf --acceleration coreml
# Use CUDA on Linux with NVIDIA GPUkreuzberg extract document.pdf --acceleration cudaPage Flags
Section titled “Page Flags”| Flag | Description |
|---|---|
--extract-pages <true|false> |
Extract pages as a separate array in results. |
--page-markers <true|false> |
Insert page marker comments into the main content string. |
kreuzberg extract document.pdf --extract-pages true --page-markers true --format jsonImage Flags
Section titled “Image Flags”| Flag | Description |
|---|---|
--extract-images <true|false> |
Enable image extraction from documents. |
--target-dpi <N> |
Target DPI for image normalisation (36 - 2400). |
kreuzberg extract document.pdf --extract-images true --target-dpi 300PDF Flags
Section titled “PDF Flags”| Flag | Description |
|---|---|
--pdf-password <PASSWORD> |
Password for encrypted PDFs. Can be specified multiple times for multiple passwords. |
--pdf-extract-images <true|false> |
Extract images embedded in PDF pages. Requires pdfium feature. |
--pdf-extract-metadata <true|false> |
Extract PDF metadata (title, author, etc.). Requires pdfium feature. |
kreuzberg extract encrypted.pdf --pdf-password "secret"kreuzberg extract document.pdf --pdf-extract-images true --pdf-extract-metadata trueToken Reduction Flags
Section titled “Token Reduction Flags”| Flag | Description |
|---|---|
--token-reduction <LEVEL> |
Token reduction intensity: off, light, moderate, aggressive, or maximum. Reduces token count for LLM consumption. |
# Aggressive token reduction for cheaper LLM processingkreuzberg extract document.pdf --token-reduction aggressive
# Maximum compression (lossy)kreuzberg extract document.pdf --token-reduction maximumQuality and Detection Flags
Section titled “Quality and Detection Flags”| Flag | Description |
|---|---|
--quality <true|false> |
Enable quality post-processing for improved formatting. |
--detect-language <true|false> |
Enable automatic language detection on extracted text. |
Cache Flags
Section titled “Cache Flags”| Flag | Description |
|---|---|
--no-cache <true|false> |
Disable extraction result caching. |
--cache-namespace <NAMESPACE> |
Cache namespace for tenant isolation. |
--cache-ttl-secs <SECONDS> |
Per-request cache TTL in seconds (0 = skip cache). |
Concurrency Flags
Section titled “Concurrency Flags”| Flag | Description |
|---|---|
--max-concurrent <N> |
Limit parallel extractions in batch mode. |
--max-threads <N> |
Cap all internal thread pools (Rayon, ONNX intra-op, batch semaphore). Useful for constrained environments. |
kreuzberg batch documents/*.pdf --max-concurrent 4 --max-threads 8Email Flags
Section titled “Email Flags”| Flag | Description |
|---|---|
--msg-codepage <N> |
Windows codepage fallback for MSG files without codepage metadata. Common values: 1250 (Central European), 1251 (Cyrillic), 1252 (Western). |
kreuzberg extract message.msg --msg-codepage 1251Output Options
Section titled “Output Options”Standard Output (Text Format)
Section titled “Standard Output (Text Format)”# Extract and print content to stdoutkreuzberg extract document.pdf
# Extract and redirect output to filekreuzberg extract document.pdf > output.txt
# Batch extract as textkreuzberg batch documents/*.pdf --format textJSON Output
Section titled “JSON Output”# Output as JSONkreuzberg extract document.pdf --format json
# Batch extract as JSON (default format)kreuzberg batch documents/*.pdf --format jsonJSON Output Structure:
The JSON output includes extracted content and related metadata:
{ "content": "Extracted text content...", "metadata": { "mime_type": "application/pdf" }}Error Handling
Section titled “Error Handling”The CLI returns appropriate exit codes on error. Basic error handling can be done with standard shell commands:
# Check for extraction errorskreuzberg extract document.pdf || echo "Extraction failed"
# Continue processing even if one file fails (bash)for file in documents/*.pdf; do kreuzberg batch "$file" || continuedoneExamples
Section titled “Examples”Extract Single PDF
Section titled “Extract Single PDF”kreuzberg extract document.pdfBatch Extract All PDFs in Directory
Section titled “Batch Extract All PDFs in Directory”kreuzberg batch documents/*.pdf --format jsonOCR Scanned Documents
Section titled “OCR Scanned Documents”kreuzberg batch scans/*.pdf --ocr true --format jsonExtract with Quality Processing
Section titled “Extract with Quality Processing”kreuzberg extract document.pdf --quality true --format jsonExtract with Chunking
Section titled “Extract with Chunking”kreuzberg extract document.pdf --config kreuzberg.toml --chunk true --chunk-size 1000 --chunk-overlap 100 --format jsonBatch Extract Multiple File Types
Section titled “Batch Extract Multiple File Types”kreuzberg batch documents/**/*.{pdf,docx,txt} --format jsonExtract with Config File
Section titled “Extract with Config File”kreuzberg extract document.pdf --config /path/to/kreuzberg.tomlDetect MIME Type
Section titled “Detect MIME Type”kreuzberg detect document.pdfDocker Usage
Section titled “Docker Usage”Use the CLI image ghcr.io/kreuzberg-dev/kreuzberg-cli:latest for command-line usage. The full image ghcr.io/kreuzberg-dev/kreuzberg-full:latest also includes the CLI.
Basic Docker
Section titled “Basic Docker”# Extract document using Docker with mounted directorydocker run -v $(pwd):/data ghcr.io/kreuzberg-dev/kreuzberg-cli:latest \ extract /data/document.pdf
# Extract and save output to host directory using shell redirectiondocker run -v $(pwd):/data ghcr.io/kreuzberg-dev/kreuzberg-cli:latest \ extract /data/document.pdf > output.txtDocker with OCR
Section titled “Docker with OCR”# Extract with OCR using Dockerdocker run -v $(pwd):/data ghcr.io/kreuzberg-dev/kreuzberg-cli:latest \ extract /data/scanned.pdf --ocr trueDocker Compose
Section titled “Docker Compose”docker-compose.yaml:
version: "3.8"
services: kreuzberg: image: ghcr.io/kreuzberg-dev/kreuzberg-cli:latest volumes: - ./documents:/input command: extract /input/document.pdf --ocr trueRun:
docker-compose upPerformance Tips
Section titled “Performance Tips”Optimize Extraction Speed
Section titled “Optimize Extraction Speed”# Extract without quality processing for faster speedkreuzberg extract large.pdf --quality false
# Use batch for processing multiple fileskreuzberg batch large_files/*.pdf --format jsonManage Memory Usage
Section titled “Manage Memory Usage”# Disable caching to reduce memory footprintkreuzberg extract large_file.pdf --no-cache true
# Compress output to save disk spacekreuzberg extract document.pdf | gzip > output.txt.gzTroubleshooting
Section titled “Troubleshooting”Check Installation
Section titled “Check Installation”# Display installed versionkreuzberg --version
# Display help for commandskreuzberg --helpCommon Issues
Section titled “Common Issues”Issue: “Tesseract not found”
When using OCR, Tesseract must be installed:
# Install Tesseract OCR engine on macOSbrew install tesseract
# Install Tesseract OCR engine on Ubuntusudo apt-get install tesseract-ocrIssue: “File not found”
Ensure the file path is correct and accessible:
# Check if file exists and is readablels -la document.pdf
# Extract with absolute pathkreuzberg extract /absolute/path/to/document.pdfServer Commands
Section titled “Server Commands”Start API Server
Section titled “Start API Server”The serve command starts a RESTful HTTP API server:
# Start server on default host (127.0.0.1) and port (8000)kreuzberg serve
# Start server on specific host and port (-H / -p are short forms)kreuzberg serve --host 0.0.0.0 --port 8000kreuzberg serve -H 0.0.0.0 -p 8000
# Start server with custom configuration filekreuzberg serve --config kreuzberg.toml --host 0.0.0.0 --port 8000Server Endpoints
Section titled “Server Endpoints”The server provides the following endpoints:
POST /extract- Extract text from uploaded filesPOST /batch- Batch extract from multiple filesGET /detect- Detect MIME type of fileGET /health- Health checkGET /info- Server informationGET /cache/stats- Cache statisticsPOST /cache/clear- Clear cache
See API Server Guide for full API details.
Start MCP Server
Section titled “Start MCP Server”The mcp command starts a Model Context Protocol server for AI integration:
# Start MCP server with stdio transport (default for Claude Desktop)kreuzberg mcp
# Start MCP server with HTTP transportkreuzberg mcp --transport http
# Start MCP server on specific HTTP host and portkreuzberg mcp --transport http --host 0.0.0.0 --port 8001
# Start MCP server with custom configuration filekreuzberg mcp --config kreuzberg.toml --transport stdioThe MCP server provides tools for AI agents:
extract_file- Extract text from a file pathextract_bytes- Extract text from base64-encoded bytesbatch_extract- Extract from multiple files
See API Server Guide for MCP integration details.
Embeddings v4.5.2
Section titled “Embeddings v4.5.2”Generate vector embeddings for text using pre-trained models. Reads from --text flags or stdin.
# Generate embeddings for a single textkreuzberg embed --text "hello world" --preset balanced
# Generate embeddings with a specific presetkreuzberg embed --text "document content" --preset fast
# Batch embed multiple textskreuzberg embed --text "first document" --text "second document" --preset quality
# Read from stdinecho "hello world" | kreuzberg embed --preset balanced
# Output as text instead of JSONkreuzberg embed --text "hello" --preset balanced --format textAvailable presets: fast, balanced (default), quality, multilingual.
Chunking Command v4.5.2
Section titled “Chunking Command v4.5.2”Split text into chunks using configurable size and overlap. Reads from --text flag or stdin.
# Chunk text with default settingskreuzberg chunk --text "long text content to be split into chunks..."
# Specify chunk size and overlapkreuzberg chunk --text "long text..." --chunk-size 512 --chunk-overlap 50
# Use markdown-aware chunkingkreuzberg chunk --text "# Heading\n\nParagraph..." --chunker-type markdown
# Use a tokenizer model for token-based sizingkreuzberg chunk --text "long text..." --chunking-tokenizer "Xenova/gpt-4o"
# Read from stdincat document.txt | kreuzberg chunk --chunk-size 1000
# Output as text instead of JSONkreuzberg chunk --text "long text..." --format text
# Use a config file for chunking settingskreuzberg chunk --text "long text..." --config kreuzberg.tomlShell Completions v4.5.2
Section titled “Shell Completions v4.5.2”Generate shell completion scripts for tab-completion support.
# Generate bash completionskreuzberg completions bash
# Generate zsh completionskreuzberg completions zsh
# Generate fish completionskreuzberg completions fish
# Install bash completionseval "$(kreuzberg completions bash)"
# Install zsh completions (add to .zshrc)eval "$(kreuzberg completions zsh)"API Utilities v4.5.2
Section titled “API Utilities v4.5.2”Dump OpenAPI Schema v4.5.2
Section titled “Dump OpenAPI Schema v4.5.2”Output the full OpenAPI 3.1 specification for the Kreuzberg REST API. Useful for code generation, documentation, and API client tooling.
# Print OpenAPI schema as JSONkreuzberg api schema
# Save to filekreuzberg api schema > openapi.jsonList Supported Formats v4.5.2
Section titled “List Supported Formats v4.5.2”List all document formats supported by Kreuzberg, including file extensions and MIME types.
# List formats as a tablekreuzberg formats
# List formats as JSONkreuzberg formats --format jsonCache Management
Section titled “Cache Management”View Cache Statistics
Section titled “View Cache Statistics”# Display cache usage statisticskreuzberg cache stats
# Display statistics for specific cache directorykreuzberg cache stats --cache-dir /path/to/cache
# Output cache statistics as JSONkreuzberg cache stats --format jsonClear Cache
Section titled “Clear Cache”# Remove all cached extraction resultskreuzberg cache clear
# Clear specific cache directorykreuzberg cache clear --cache-dir /path/to/cache
# Clear cache and display removal detailskreuzberg cache clear --format jsonWarm Model Cache v4.5.0
Section titled “Warm Model Cache v4.5.0”Pre-download all ML models (PaddleOCR and layout detection) so they are ready for offline use. This is especially useful for containerized deployments.
By default, models are stored in the platform-specific global cache directory:
- Linux:
~/.cache/kreuzberg/{module}(or$XDG_CACHE_HOME/kreuzberg/{module}) - macOS:
~/Library/Caches/kreuzberg/{module} - Windows:
%LOCALAPPDATA%/kreuzberg/{module}
Override with KREUZBERG_CACHE_DIR or --cache-dir.
# Download all OCR and layout models eagerlykreuzberg cache warm
# Download to a specific cache directorykreuzberg cache warm --cache-dir /path/to/cache
# Also download all 4 embedding model presets (fast, balanced, quality, multilingual)kreuzberg cache warm --all-embeddings
# Download a specific embedding model presetkreuzberg cache warm --embedding-model balanced
# Output download results as JSONkreuzberg cache warm --format jsonModel Manifest v4.5.0
Section titled “Model Manifest v4.5.0”Output a manifest of all expected model files with their SHA256 checksums and sizes. Useful for verifying cache integrity or scripting model pre-population.
# Output manifest as JSON (default)kreuzberg cache manifest
# Output manifest as human-readable textkreuzberg cache manifest --format textGetting Help
Section titled “Getting Help”CLI Help
Section titled “CLI Help”# Display general CLI helpkreuzberg --help
# Display command-specific helpkreuzberg extract --helpkreuzberg batch --helpkreuzberg detect --helpkreuzberg formats --helpkreuzberg version --helpkreuzberg embed --helpkreuzberg chunk --helpkreuzberg completions --helpkreuzberg serve --helpkreuzberg mcp --helpkreuzberg cache --helpkreuzberg cache stats --helpkreuzberg cache clear --helpkreuzberg cache warm --helpkreuzberg cache manifest --helpkreuzberg api schema --helpVersion Information
Section titled “Version Information”# Display version numberkreuzberg --version
# Show version with JSON outputkreuzberg version --format jsonThe version command displays the Kreuzberg version. Use --format json for machine-readable output.
Next Steps
Section titled “Next Steps”- API Server Guide - API and MCP server setup
- Chunking & Embeddings - Chunking, embeddings, and post-extraction processing
- Plugin Development - Extend Kreuzberg functionality
- API Reference - Programmatic access