Configuration Reference

Complete reference for all CLI flags and environment variables accepted by the rabbithole binary. Source: github.com/ajbt200128/rabbithole. Live demo: isarabbithole.com.

Quick Start

# Minimum viable invocation
export ANTHROPIC_API_KEY="sk-ant-..."
rabbithole --seed "A wiki about the Rust programming language"

# With a file-based seed and budget cap
rabbithole --seed-file ./seed.txt --max-cost 2.00 --db ./site.db

# Full example
rabbithole \
  --seed-file ./prompts/seed.txt \
  --port 3000 \
  --model claude-haiku-4-5 \
  --max-tokens 8192 \
  --depth-limit 4 \
  --db ./rabbithole.sqlite \
  --max-cost 5.00 \
  --four-oh-four ./static/404.html

CLI Flags

All flags are parsed by clap. Run rabbithole --help for a summary.

Flag Type Default Description
--seed <STRING> String none Seed prompt string for the homepage. The LLM receives this as its page-generation brief for /index.html. Mutually exclusive with --seed-file. One of the two must be provided.
--seed-file <PATH> Path none Read the seed prompt from a file on disk. Useful for long or multi-paragraph prompts that would be unwieldy on the command line. Mutually exclusive with --seed.
--port <NUMBER> u16 8080 TCP port for the Actix-web HTTP server to listen on. Ensure the port is not already in use. Use --port 80 for standard HTTP (requires elevated privileges on Linux).
--model <STRING> String claude-sonnet-4-5 Anthropic model identifier to use for page generation. See Model Pricing below. Accepted values include: claude-opus-4-5, claude-sonnet-4-5, claude-haiku-4-5. Any valid Anthropic API model string is accepted; Rabbithole passes the value directly to the API.
--max-tokens <NUMBER> u32 8192 Maximum number of output tokens per LLM response. Higher values allow more complex, longer pages but increase cost and latency per request. The Anthropic API hard cap is model-dependent (typically 8192–16384).
--depth-limit <NUMBER> u32 5 Maximum recursion depth for page generation. Pages at depth 0 are directly linked from the seed homepage. Pages that would be generated at the limit are still rendered, but they produce no outbound link mappings — preventing further graph expansion. Also configurable via RABBITHOLE_DEPTH_LIMIT.
--db <PATH> Path none Path to a SQLite database file for persistent page storage. If this flag is omitted, an in-memory store is used — all cached pages are lost when the process exits. Specify a file path for production or long-running deployments to survive restarts. Example: --db /var/lib/rabbithole/pages.sqlite
--no-web-tools Flag (bool) false Disable the web_search and web_fetch tool calls during page generation. When set, the LLM generates pages from its training knowledge only, without real-time web research. See Web Tools for details on how these tools work when enabled.
--max-cost <DOLLARS> f64 (USD) none Hard budget cap in US dollars. Once total accumulated API spend exceeds this value, any request for an uncached page will return an HTTP 404 redirect instead of generating a new page. Already-cached pages continue to be served normally at no additional cost. Strongly recommended for any public deployment. Also configurable via RABBITHOLE_MAX_COST.
--four-oh-four <PATH> Path built-in Path to a custom HTML file to serve as the 404 error page. If omitted, Rabbithole serves a minimal built-in 404 response. The file is read from disk at startup; changes after startup require a restart. Example: --four-oh-four ./static/404.html
Note: Either --seed or --seed-file must be provided. They are mutually exclusive; providing both is an error.
Warning: Without --max-cost or --db, a publicly accessible Rabbithole instance can accumulate unbounded API spend. A determined crawler or curious visitor can generate many pages quickly. Always set --max-cost in production.

Environment Variables

These variables are read at startup. CLI flags take precedence over environment variables where both apply.

Variable Required Description
ANTHROPIC_API_KEY Required Your Anthropic API key, beginning with sk-ant-. Obtain one from console.anthropic.com. This variable must be set; Rabbithole will refuse to start without it. Do not commit this value to version control. Use a secrets manager or .env file in development.
RABBITHOLE_DEPTH_LIMIT Optional Override the depth limit without passing --depth-limit on the command line. Useful in containerized deployments where environment variables are easier to manage than CLI args. Equivalent to --depth-limit. If both are specified, the CLI flag takes precedence.
RABBITHOLE_MAX_COST Optional Override the budget cap without passing --max-cost on the command line. Accepts a decimal USD value, e.g. 5.00. Equivalent to --max-cost. If both are specified, the CLI flag takes precedence.

Setting Environment Variables

# Shell (temporary, current session)
export ANTHROPIC_API_KEY="sk-ant-api03-..."
export RABBITHOLE_MAX_COST="3.00"
export RABBITHOLE_DEPTH_LIMIT="4"
rabbithole --seed "A recipe site"

# Using a .env file (with a tool like direnv or dotenv)
# .env
ANTHROPIC_API_KEY=sk-ant-api03-...
RABBITHOLE_MAX_COST=3.00
RABBITHOLE_DEPTH_LIMIT=4

# Docker / docker-compose
environment:
  - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
  - RABBITHOLE_MAX_COST=10.00
  - RABBITHOLE_DEPTH_LIMIT=5

Model Pricing

Rabbithole calls the Anthropic Messages API on each uncached page request. Each page generation costs approximately 1,000–4,000 input tokens (system prompt + mappings context) plus up to --max-tokens output tokens. Choose your model based on cost tolerance and quality requirements.

Model Flag value Input (per 1M tokens) Output (per 1M tokens) Notes
Claude Opus 4.5 claude-opus-4-5 $5.00 $25.00 Most capable. Best page quality, highest cost. Use for flagship public sites.
Claude Sonnet 4.5 claude-sonnet-4-5 $3.00 $15.00 Default. Good balance of quality and cost. Recommended for most use cases.
Claude Haiku 4.5 claude-haiku-4-5 $1.00 $5.00 Fastest and cheapest. Suitable for prototyping, high-depth exploration, or cost-sensitive deployments.
Pricing note: The table above reflects current Anthropic API list prices as of early 2026. Prices may change; always verify at anthropic.com/pricing before estimating costs for a production deployment. Legacy models such as Opus 4.1 carry higher rates ($15/$75 per million tokens).

Estimating Cost Per Page

# Rough cost model (Sonnet 4.5, default settings):
#
#   Input:  ~2,000 tokens  (system prompt + context)  @ $3.00/MTok  = $0.000006
#   Output: ~8,192 tokens  (full HTML page)            @ $15.00/MTok = $0.000123
#   Total per page:  ~$0.000129  (~$0.13 per 1,000 pages)
#
# With Haiku 4.5:
#   Input:  ~2,000 tokens                              @ $1.00/MTok  = $0.000002
#   Output: ~8,192 tokens                              @ $5.00/MTok  = $0.000041
#   Total per page:  ~$0.000043  (~$0.043 per 1,000 pages)
#
# --max-cost 1.00 buys roughly:
#   Sonnet 4.5:  ~7,750 uncached pages
#   Haiku 4.5:   ~23,200 uncached pages

Persistence and the SQLite Database

When --db is provided, Rabbithole stores all generated pages and their URL-to-prompt mappings in a SQLite file. On subsequent startups with the same --db path, previously generated pages are served from the database without any API calls — so cached pages are effectively free.

The database also stores the accumulated cost counter used by --max-cost. If you hit the cost cap and want to continue generating new pages, you can either raise --max-cost or clear the cost counter manually.

# Inspect the database with sqlite3:
sqlite3 ./rabbithole.sqlite ".tables"
# pages   mappings   meta

sqlite3 ./rabbithole.sqlite "SELECT url, length(html) FROM pages ORDER BY rowid DESC LIMIT 10;"
sqlite3 ./rabbithole.sqlite "SELECT value FROM meta WHERE key='total_cost';"

Depth Limit Behavior

The --depth-limit flag controls how deep the link graph can grow. Depth is tracked per URL in the mapping:

# Example: prevent any sub-pages (homepage only)
rabbithole --seed "A single-page site" --depth-limit 0

# Example: allow two levels deep from homepage
rabbithole --seed-file seed.txt --depth-limit 2

Custom 404 Page

By default, budget-exceeded and unknown-path requests return a minimal built-in 404 page. Use --four-oh-four to serve a branded page instead. The file must be valid HTML and is read once at startup.

# custom-404.html example
cat > ./static/404.html << 'EOF'
<!DOCTYPE html>
<html>
<head><title>Not Found</title></head>
<body>
  <h1>404 — Page Not Found</h1>
  <p>This page has not been generated yet (or the budget cap was reached).</p>
  <p><a href="/">Return to homepage</a></p>
</body>
</html>
EOF

rabbithole --seed "My site" --four-oh-four ./static/404.html

Flag Reference Summary

rabbithole [OPTIONS]

OPTIONS:
    --seed <STRING>          Seed prompt string (mutually exclusive with --seed-file)
    --seed-file <PATH>       Read seed prompt from file (mutually exclusive with --seed)
    --port <NUMBER>          HTTP port [default: 8080]
    --model <STRING>         Anthropic model [default: claude-sonnet-4-5]
    --max-tokens <NUMBER>    Max output tokens per response [default: 8192]
    --depth-limit <NUMBER>   Max link graph depth [default: 5]
    --db <PATH>              SQLite database path [default: in-memory]
    --no-web-tools           Disable web_search / web_fetch tools
    --max-cost <DOLLARS>     Budget cap in USD (strongly recommended)
    --four-oh-four <PATH>    Custom 404 HTML file path
    -h, --help               Print help information
    -V, --version            Print version information

See Also