Configuration¶
Anknote provides flexible configuration through files, environment variables, and command-line arguments.
Configuration Files¶
Creating a Configuration File¶
Create a default configuration file:
This creates .anknote.json
in your current directory with default settings:
{
"model": "gemini/gemini-2.0-flash-lite",
"max_retries": 3,
"skip_readme": true,
"file_extensions": [".md", ".markdown"],
"output_format": "tsv",
"escape_tabs": true,
"log_level": "INFO"
}
Configuration File Locations¶
Anknote looks for configuration files in this order:
- Current directory:
.anknote.json
- Home directory:
~/.config/anknote/config.json
- XDG config:
$XDG_CONFIG_HOME/anknote/config.json
Using Custom Configuration¶
Specify a custom configuration file:
View current configuration:
Configuration Options¶
AI Model Settings¶
- model: AI model identifier (supports LiteLLM format)
- max_retries: Maximum API retry attempts
File Processing Settings¶
- skip_readme: Skip README files when processing directories
- file_extensions: File extensions to process
Output Settings¶
- output_format: Output file format (currently only "tsv")
- escape_tabs: Escape tab characters in content
Logging Settings¶
- log_level: Logging verbosity (DEBUG, INFO, WARNING, ERROR)
Environment Variables¶
Override configuration with environment variables:
export ANKNOTE_MODEL="claude-3-haiku-20240307"
export ANKNOTE_MAX_RETRIES="10"
export ANKNOTE_LOG_LEVEL="DEBUG"
Environment variables take precedence over configuration files.
Supported AI Models¶
Anknote uses LiteLLM, supporting many providers:
OpenAI¶
Set API key: export OPENAI_API_KEY="your-key"
Anthropic (Claude)¶
Set API key: export ANTHROPIC_API_KEY="your-key"
Google (Gemini)¶
Set API key: export GOOGLE_API_KEY="your-key"
Azure OpenAI¶
Additional Azure environment variables required.
Configuration Examples¶
Cost-Optimized Setup¶
For minimal costs while maintaining quality:
High-Quality Setup¶
For maximum quality flashcards:
Development Setup¶
For development and debugging:
Custom File Types¶
Process additional file types:
Advanced Configuration¶
Custom Prompts¶
Use a custom prompt file:
The prompt file should contain instructions for the AI model on how to generate flashcards.
Project-Specific Configuration¶
For different projects, create project-specific configs:
# Academic project
anknote notes/ --config configs/academic.json
# Work notes
anknote work-notes/ --config configs/work.json
Batch Configuration¶
For processing multiple directories with different settings:
#!/bin/bash
anknote academic-notes/ --config academic.json -o anki/academic/
anknote work-notes/ --config work.json -o anki/work/
anknote personal-notes/ --config personal.json -o anki/personal/
Priority Order¶
Configuration values are applied in this order (highest to lowest priority):
- Command-line arguments
- Environment variables
- Configuration file
- Default values
Validation¶
Anknote validates all configuration values:
- Model names are checked for basic format
- Retry counts must be positive integers
- Log levels must be valid Python logging levels
- File extensions must start with a dot
Invalid configurations will show an error message with suggestions for fixing them.