Installation
Requirements
- Python 3.11 or later
- An Anthropic API key (or a compatible gateway)
Install from PyPI
pip install scrivai
Install from Source (development)
git clone https://github.com/iomgaa-ycz/Scrivai.git
cd Scrivai
pip install -e ".[dev]"
Environment Configuration
Copy the example env file and fill in your values:
cp .env.example .env
| Variable | Required | Description |
|---|---|---|
ANTHROPIC_API_KEY |
Yes | Your Anthropic API key (or gateway token) |
ANTHROPIC_BASE_URL |
No | Override the API base URL (e.g. for a private gateway) |
SCRIVAI_DEFAULT_MODEL |
No | Default model ID used by ModelConfig (e.g. claude-sonnet-4-20250514) |
SCRIVAI_DEFAULT_PROVIDER |
No | Provider label written to trajectory records (e.g. anthropic) |
OCR Configuration
The IO module (MarkdownConverter / to_markdown()) supports multiple OCR backends. For simple setups, configure via environment variables. For multi-backend or advanced configuration, use ConverterConfig in code (see Concepts: IO).
| Variable | Description |
|---|---|
SCRIVAI_GLM_API_KEY |
GLM-OCR API key (get from open.bigmodel.cn). For multiple keys, use ConverterConfig.glm_api_keys in code. |
SCRIVAI_OCR_BASE_URL |
MonkeyOCR endpoint URL. For multiple endpoints, use ConverterConfig.monkey_endpoints in code. |
SCRIVAI_MINERU_URL |
MinerU router URL (leave empty to auto-start a local mineru-router in GPU mode) |
Using a Private Gateway
If you route through a proxy or private LLM gateway, set ANTHROPIC_BASE_URL to the gateway's base URL. The Claude Agent SDK reads this variable automatically — no code changes are required.
export ANTHROPIC_BASE_URL=https://my-gateway.example.com
export ANTHROPIC_API_KEY=my-gateway-key
export SCRIVAI_DEFAULT_MODEL=claude-sonnet-4-20250514
Verify the Installation
import scrivai
print(scrivai.__version__)