View as AI
View Website As AI. Preview the model-readable information a browsing system is likely to receive from a webpage.
View as AI is a lightweight Python CLI and library empirically calibrated against native ChatGPT web.run open() output. It runs locally, uses direct HTTP origin HTML, and makes no OpenAI API calls.
The calibration target is information presence, omission, ordering, links, images, and controls. Markdown details and line layout can differ from native ChatGPT output.
Install
Requires Python 3.11+.
Install the CLI from PyPI:
uv tool install view-as-ai
view-as-ai https://example.com
For library use:
uv add view-as-ai
For development:
uv sync --group dev
uv run view-as-ai https://example.com
CLI
# Public webpage
view-as-ai https://example.com
# Plain model-readable text
view-as-ai https://example.com --format text
# Structured output with reference URLs
view-as-ai https://example.com --format json
# Local or built HTML
view-as-ai ./dist/index.html --base-url https://example.com/
# HTML from stdin
curl -fsSL https://example.com | view-as-ai - --base-url https://example.com/
# Save output
view-as-ai https://example.com -o preview.txt
The default view format adds line numbers for inspection:
Example Domain (https://example.com/)
View as AI preview; Total lines: 5
L0: # Example Domain
L1:
L2: This domain is for use in documentation examples without needing permission. Avoid use in operations.
L3:
L4: 【0†Learn more†iana.org】
--format json returns the page URL, model-readable text, title, and the reference URL map:
{
"url": "https://example.com/",
"text": "# Example Domain\n\n...",
"title": "Example Domain",
"urls": {
"0": "https://iana.org/domains/example"
}
}
The CLI follows HTTP redirects, accepts HTML/XHTML responses, and uses a 30-second default timeout. Run view-as-ai --help for the complete option list. python -m view_as_ai exposes the same CLI.
Python API
from view_as_ai import process_html, prune_html
html = "<h1>Pricing</h1><button>Start trial</button>"
page = process_html(prune_html(html), "https://example.com/pricing")
print(page.title)
print(page.text)
print(page.urls)
process_html() is pure and performs no I/O. It returns a PageContents dataclass with url, text, title, and urls fields. prune_html() applies the conservative provider-style pruning used by the CLI.
What it approximates
The stable runtime path is deliberately small:
HTTP origin HTML
↓
conservative provider-style pruning
↓
OpenAI-derived HTML-to-model-text formatter
↓
model-readable text + reference URLs
The parser preserves useful model-visible information such as headings, prose, lists, tables, code, links, image descriptions, buttons, inputs, selects, and document order. Pruning removes a narrow set of recurring navigation and UI patterns supported by calibration evidence.
Client-side JavaScript execution, shadow DOM traversal, and fetching iframe documents are outside the runtime. Browser-rendered DOM was removed after broad calibration because it generally reduced resemblance to the recorded native output.
Calibration and limitations
View as AI is a best-effort approximation based on recorded native ChatGPT browsing observations. The broad stabilization calibration reached roughly 99% average information-level resemblance after normalization. That figure is an aggregate calibration result, and individual pages can diverge.
Expected sources of difference include:
- Sites serving different HTML to different user agents or crawlers.
- Content created only after client-side JavaScript runs.
- Shadow DOM and fetched iframe contents.
- Images whose meaning exists only in pixels instead of
altortitletext. - Unusual navigation, widgets, or page structures outside the calibration set.
- Whitespace, Markdown structure, heading levels, reference numbering, and line counts.
The active repository keeps compact native golden fixtures plus synthetic parser and pruner regressions. The larger reverse-engineering corpus and oracle tooling are archived separately for future recalibration if native behavior changes materially.
Verification and maintenance
uv sync --group dev
uv run pytest -q
uv run ruff check src tests
uv run ruff format --check src tests
uv build
Routine maintenance is evidence-driven: reproduce meaningful information differences against native output, add the smallest generic fix, and preserve conservative pruning. The installed wheel contains the runtime package and required third-party attribution files.
Source lineage and attribution
The formatter began from OpenAI's public gpt-oss gpt_oss/tools/simple_browser/page_contents.py at revision 750cfe908fdc9dd1f0e9bfcd92a4bb1adb0aa81c and was adapted for View as AI's standalone parser and empirical calibration. OpenAI source attribution, the upstream Apache-2.0 license, and dependency notices are preserved in THIRD_PARTY_NOTICES.md and licenses/.
View as AI is distributed under GPL-3.0-or-later.
Developed & maintained by Serbyte Development · GitHub
Release files for view-as-ai 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| view_as_ai-1.0.0.tar.gz | 58.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| view_as_ai-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 89.1 kB
Release files / view_as_ai-1.0.0.tar.gz
| Download URL | view_as_ai-1.0.0.tar.gz |
|---|---|
| Size | 58.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
405ebd5e6e7847a8f1e79270605c23446566da3aafe8eeb6757caa1b37a450a1
|
|
BLAKE2b-256 checksum How to use checksums |
3b23f980aff85b2cdac6cfcb77d7720d3fcf6606c310cad71467f5b26f7c6835
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency logRelease files / view_as_ai-1.0.0-py3-none-any.whl
| Download URL | view_as_ai-1.0.0-py3-none-any.whl |
|---|---|
| Size | 31.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e55102143c248b284601561b9b798f54961291f61af2a470fa1b7cef3d8b695
|
|
BLAKE2b-256 checksum How to use checksums |
573826162a9e48eace725e36dfcf1ceac6b43499183702ae092ea9965b7d41ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency log