Metadata-Version: 2.1
Name: openslides-ai
Version: 1.2.0
Summary: Brand-first slide deck library. Full creative control, zero abstraction tax.
Author-email: Federico De Ponte <depontefede@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/federicodeponte/openslides
Project-URL: Repository, https://github.com/federicodeponte/openslides
Keywords: slides,presentation,pitch-deck,brand,html,png
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: playwright >=1.40.0
Provides-Extra: all
Requires-Dist: aiohttp >=3.9.0 ; extra == 'all'
Requires-Dist: anthropic >=0.20.0 ; extra == 'all'
Requires-Dist: openai >=1.0.0 ; extra == 'all'
Provides-Extra: anthropic
Requires-Dist: anthropic >=0.20.0 ; extra == 'anthropic'
Provides-Extra: dev
Requires-Dist: pytest-asyncio >=0.21.0 ; extra == 'dev'
Requires-Dist: pytest >=7.0.0 ; extra == 'dev'
Provides-Extra: extract
Requires-Dist: aiohttp >=3.9.0 ; extra == 'extract'
Provides-Extra: openai
Requires-Dist: openai >=1.0.0 ; extra == 'openai'

# openslides

[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
[![Tests](https://github.com/federicodeponte/openslides/actions/workflows/ci.yml/badge.svg)](https://github.com/federicodeponte/openslides/actions)

**Brand-first AI slide deck generator.** Point it at any website, get a pitch deck in that brand's exact colors, fonts, and style.

65+ curated brands. Real SVG logos. One command.

![openslides demo](demo.png)

## Quick Start

```bash
pip install openslides-ai
playwright install chromium
```

### Generate a deck (LLM-powered)

![terminal demo](terminal-demo.png)

```bash
export GEMINI_API_KEY=your-key

# Generate 5 slides for Stripe
openslides generate stripe.com "Payment infrastructure for the internet" -n 5

# Generate for any brand in the database
openslides generate airbnb.com "Community-powered hospitality platform" -n 3
openslides generate spotify.com "Audio streaming and discovery" -n 3
```

Output: pixel-perfect 1920x1080 PNGs in `/tmp/<domain>-deck/`.

### Generate from Python

```python
from openslides import Brand, generate, export

brand = Brand.from_domain("stripe.com")
slides = generate(brand, "Payment infrastructure for the internet", num_slides=5)
export(slides, "/tmp/stripe-deck/")
```

The `generate()` function:
- Picks a layout variant per slide type (hero, dashboard, terminal, CTA)
- Sends a detailed blueprint + brand context to Gemini Pro
- Post-processes: injects real SVG logo, grid pattern, ambient glow, layout CSS
- Fixes round numbers, banned patterns, readability issues automatically

### Build manual slides

For full creative control, write HTML/CSS directly:

```python
from openslides import Brand, export, base_html

brand = Brand.from_domain("stripe.com")

def slide_hero():
    return f'''
    {base_html(brand)}
    <body style="background:{brand.background}; padding:80px;">
        <h1 style="font-family:'{brand.font_headline}'; font-size:72px; color:{brand.text};">
            The GDP of the internet runs on
            <span style="color:{brand.primary};">7 lines</span> of code.
        </h1>
    </body></html>
    '''

export([slide_hero()], "/tmp/stripe-deck/")
```

## Brand Database

65+ curated brands with verified colors, fonts, and typography pairings:

```python
from openslides import Brand

brand = Brand.from_domain("stripe.com")
print(brand.primary)        # "#635bff"
print(brand.font_headline)  # "Space Grotesk"
print(brand.logo_img(32))   # Real SVG logo at 32px
```

Brands with real SVG logos: Stripe, Anthropic, Airbnb, Spotify, Shopify.

All 65+ brands have curated color palettes and distinctive headline fonts (never generic Inter). Full list in [`brands.py`](openslides/brands.py).

### Manual brand definition

```python
brand = Brand(
    primary="#054dfe",
    secondary="#15aebf",
    background="#fdfbf5",
    surface="#ffffff",
    text="#191919",
    muted="#6b6b6b",
    font_headline="Syne",
    font_body="Inter",
)
```

## CLI

```bash
# LLM generation
openslides generate <domain> "<topic>" [-n slides] [-p gemini|openai|anthropic] [-o dir]

# Build from Python file
openslides build examples/scaile.py [-o dir] [-f png|pdf]

# List slides in a file
openslides list examples/scaile.py
```

## LLM Providers

Generation uses Gemini Pro by default (free tier available). Zero additional dependencies needed.

```bash
# Gemini (default, zero deps)
export GEMINI_API_KEY=your-key
openslides generate stripe.com "..."

# OpenAI (pip install openslides-ai[openai])
export OPENAI_API_KEY=your-key
openslides generate stripe.com "..." -p openai

# Anthropic (pip install openslides-ai[anthropic])
export ANTHROPIC_API_KEY=your-key
openslides generate stripe.com "..." -p anthropic
```

## API Reference

### `Brand`

Dataclass holding brand assets. Fields: `primary`, `secondary`, `background`, `surface`, `text`, `muted`, `font_headline`, `font_body`, `logo_svg`, `logo_url`, `name`, `domain`.

- `Brand.from_domain(url)` - Load from curated database or extract from website
- `brand.logo_img(size)` - Real SVG logo (or Clearbit fallback)
- `brand.google_fonts_url` - Google Fonts URL for brand fonts

### `generate(brand, topic, num_slides=5, provider="gemini", model=None)`

Generate slides using LLM. Returns list of HTML strings.

### `export(slides, output_dir, width=1920, height=1080, format="png")`

Render HTML slides to PNG or PDF via Playwright.

### `base_html(brand)` / `base_styles(brand)`

HTML boilerplate and CSS utilities for manual slide authoring.

## License

MIT
