docparser/Configuration
Configuration
Configure docparser's VLM providers and defaults via environment variables or a .env file.
docparser reads configuration from the environment (or a .env file in the
working directory). Most settings control the VLM captioning provider —
parsing itself needs no configuration.
.env variables
| Var | Default | Purpose |
|---|---|---|
DOCPARSER_VLM_PROVIDER | openrouter | openrouter / openai / gemini / local |
OPENROUTER_API_KEY | required for OpenRouter | OpenRouter key (sk-or-...) |
OPENROUTER_VLM_MODEL | anthropic/claude-sonnet-4 | any vision-capable OpenRouter model |
OPENROUTER_BASE_URL | https://openrouter.ai/api/v1 | override for a proxy |
OPENROUTER_REFERER / OPENROUTER_TITLE | repo URL / docparser | OpenRouter attribution headers |
OPENAI_API_KEY / OPENAI_VLM_MODEL | required for OpenAI / gpt-4o-mini | OpenAI provider |
GEMINI_API_KEY / GEMINI_VLM_MODEL | required for Gemini / gemini-1.5-flash | Gemini provider |
DOCPARSER_VLM_BASE_URL | http://localhost:11434/v1 | base URL for the local provider |
DOCPARSER_VLM_API_KEY / DOCPARSER_VLM_MODEL | — / llava | key + model for the local provider |
DOCPARSER_LOCAL_VLM_MODEL | Salesforce/blip-image-captioning-large | model for the transformers backend |
Example .env
# OpenRouter (default provider)
OPENROUTER_API_KEY=sk-or-v1-...
OPENROUTER_VLM_MODEL=anthropic/claude-sonnet-4Or for a fully-local Ollama-style server:
DOCPARSER_VLM_PROVIDER=local
DOCPARSER_VLM_BASE_URL=http://localhost:11434/v1
DOCPARSER_VLM_MODEL=llavaPrecedence
CLI flags (--vlm-provider, --vlm-model) and library arguments (provider=,
model=) override the environment, so you can set a sane default in .env and
adjust per-run.
No keys needed for parsing
Configuration only matters when captioning is enabled. Run with --no-vlm (CLI)
or use_vlm=False (library) to parse documents without any API keys.
Next
- See the providers in detail in Image captioning (VLM).
- Browse the programmatic surface in the API reference.