Catalog PyPI
PACKAGE EXPLORERView in registry

ai-context-cli

PyPI

CLI: HTTP(S) or local file/dir → Readability → Markdown; optional LiteLLM summary; optional --max-tokens truncation.

aiclicontextlitellmllmmarkdownollamaopenrouterreadabilityscraper
Versions collected1
Direct dependencies14From release 1.0.0
Last observed21 Oct, 10:16 UTC

README

Version 1.0.0 documentation

ai-context-cli

PyPI version Python versions License

HTTP(S) → clean Markdown for LLM context: httpx fetch → Readability → markdownify; optional LiteLLM summary with --summary (lazy-loaded — no LLM stack until you opt in).

# Markdown only (stdout stays pipe-clean; errors → stderr)
ai-context-cli "https://example.com/article"

# Same + LLM summary (loads .env from cwd for API keys)
ai-context-cli "https://example.com/article" --summary

# Verbose pipeline logs on stderr
ai-context-cli "https://example.com/article" --summary -v

Architecture and conventions: SPEC.md.

⚡ Why

Raw HTML wastes tokens. ai-context-cli is a small preprocessing step: one URL in, readable Markdown (and optionally a short summary) out.

🧩 What you get

  • Readability-based main content extraction (readability-lxml)
  • Markdown via markdownify
  • Optional LLM summary via LiteLLM (--summary, --model)
  • Typed errors → stable CLI exit codes (see SPEC.md §7)

Scope today: SOURCE is an http(s) URL or a local file or directory (UTF-8 text; see SPEC §5). --structure and --version are available.

Quick Start

# 1) Install
pip install ai-context-cli

# 2) Convert a page to Markdown
ai-context-cli "https://example.com/article"

# 3) Show installed version
ai-context-cli --version

# 4) Add a summary block
ai-context-cli "https://example.com/article" --summary

📦 Install

From a clone (dev):

python3 -m venv .venv
source .venv/bin/activate   # Windows: .\.venv\Scripts\Activate.ps1
pip install -U pip
pip install -e ".[dev]"
ai-context-cli --help

From PyPI: pip install ai-context-cli

Requires Python 3.11+.

🤖 LLM providers (LiteLLM)

--summary uses LiteLLM model ids. Set the provider’s native env vars (also read from a .env in the working directory when --summary is used).

ProviderExample --modelCredentials
OpenAIgpt-4o-mini (default if --model omitted)OPENAI_API_KEY
Anthropicanthropic/claude-3-5-sonnet-latestANTHROPIC_API_KEY
OpenRouteropenrouter/openai/gpt-4o-mini (pick any model slug OpenRouter exposes)OPENROUTER_API_KEY
Ollama (local)ollama/llama3Optional: OLLAMA_API_BASE (default http://localhost:11434)
ai-context-cli "https://example.com/article" --summary --model "openrouter/openai/gpt-4o-mini"
ai-context-cli "https://example.com/article" --summary --model "ollama/llama3"

See .env.example for other keys (MISTRAL_API_KEY, timeouts, etc.).

🧪 Tests & lint

pytest
ruff check .
ruff format --check .
mypy src

🤝 Contributing

See CONTRIBUTING.md (layers, ports/adapters, where to put code).

📝 Changelog

Release notes are tracked in CHANGELOG.md.

📄 License

MIT — see LICENSE.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.016 Apr 202614

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
hushout/ai-context-cli

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 10:16 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:81820210754fcfe9cb4b660cdf7979cb1f5e09b02da769d1b75151ddf6a5f840