Files
pdf-to-kcf/QUICKSTART.md
neutrino2211 b847133df2 Init
2025-12-19 20:41:08 +01:00

128 lines
3.2 KiB
Markdown

# Quick Start Guide
## 1. Get Your OpenRouter API Key
1. Visit [OpenRouter](https://openrouter.ai/)
2. Sign up for a free account
3. Go to [Keys](https://openrouter.ai/keys) section
4. Create a new API key
5. Copy your API key
## 2. Configure the Tool
```bash
# Copy the environment template
cp .env.example .env
# Edit .env and add your API key
echo "OPENROUTER_API_KEY=your_key_here" >> .env
```
Or set it directly in your shell:
```bash
export OPENROUTER_API_KEY=your_key_here
```
## 3. Run Your First Analysis
```bash
# Basic usage
uv run pdf-to-kcf your_document.pdf
# This will create a file: your_document_insights.json
```
## Example Output
The tool will generate a JSON file with structured insights like:
```json
{
"insights": [
{
"type": "fact",
"insight": "The company revenue increased by 25% in Q4",
"content": "According to the financial report, Q4 revenue reached $2.5M, up 25% from Q3...",
"attributes": [
{"attribute": "source", "value": "Financial Report"},
{"attribute": "quarter", "value": "Q4"},
{"attribute": "confidence", "value": "high"}
]
},
{
"type": "opinion",
"insight": "The author recommends investing in AI infrastructure",
"content": "We strongly believe that investing in AI infrastructure is critical...",
"attributes": [
{"attribute": "sentiment", "value": "positive"},
{"attribute": "section", "value": "recommendations"}
]
}
]
}
```
## Advanced Usage
### Try Different Models
```bash
# Use GPT-4
uv run pdf-to-kcf document.pdf -m openai/gpt-4o
# Use Gemini
uv run pdf-to-kcf document.pdf -m google/gemini-pro-1.5
# Use Llama 3.1
uv run pdf-to-kcf document.pdf -m meta-llama/llama-3.1-70b-instruct
```
### Custom Output Location
```bash
uv run pdf-to-kcf document.pdf -o /path/to/output.json
```
### Start from Specific Page
```bash
# Start analysis from page 5 (0-indexed, so this is the 6th page)
uv run pdf-to-kcf document.pdf -s 5
```
## How It Works
1. The tool loads your PDF and extracts text
2. An AI agent analyzes the content starting from page 0 (or your specified page)
3. The agent autonomously decides if it needs to read more pages
4. It extracts structured insights classified as facts, opinions, or comments
5. Each insight includes the original content and relevant metadata
6. Results are saved to a JSON file
## Pricing
OpenRouter charges based on the model you use:
- Claude 3.5 Sonnet (default): ~$3 per million input tokens
- GPT-4o: ~$2.50 per million input tokens
- Llama 3.1 70B: ~$0.35 per million input tokens
Most PDFs will cost just a few cents to analyze.
## Troubleshooting
### "No API key found"
Make sure you've set `OPENROUTER_API_KEY` in your `.env` file or environment.
### "Model not found"
Check the model name format: `<provider>/<model-name>` (e.g., `anthropic/claude-3.5-sonnet`)
See available models at https://openrouter.ai/models
### "PDF not found"
Use the full path to your PDF file, or navigate to the directory containing it first.
## Next Steps
- Read the full [README.md](README.md) for more details
- Check [CLAUDE.md](CLAUDE.md) for architecture details
- See [OpenRouter models](https://openrouter.ai/models) for all available models