Metadata-Version: 2.4
Name: xithead
Version: 1.2.2
Summary: Aggressive Claude context optimizer by Xtream-ITSolutions UG - Cut costs by 50-95%
Author-email: Xtream-ITSolutions UG <hello@xtream-itsolutions.com>
Project-URL: Homepage, https://github.com/xtream-itsolutions/headroom
Project-URL: Discord, https://discord.gg/xtream-itsolutions
Keywords: claude,anthropic,llm,token,optimization,caching,proxy,ai
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.1.0
Provides-Extra: proxy
Requires-Dist: fastapi>=0.100.0; extra == "proxy"
Requires-Dist: uvicorn<1.0,>=0.23.0; extra == "proxy"
Requires-Dist: httpx>=0.24.0; extra == "proxy"
Provides-Extra: full
Requires-Dist: xithead[proxy]; extra == "full"
Dynamic: license-file

<div align="center">
  <img src="https://cdn.xtream-itsolutions.com/u/logo.png" alt="Xtream-ITSolutions UG" width="140" />
  <br/><br/>
  <h1>⚡ xithead</h1>
  <p><strong>Claude Context Optimizer — bis zu 95% Token-Einsparung, automatisch</strong></p>
  <p>
    <a href="https://pypi.org/project/xithead/"><img src="https://img.shields.io/pypi/v/xithead?color=00e5ff&label=PyPI&style=flat-square" alt="PyPI" /></a>
    <a href="https://www.npmjs.com/package/xithead"><img src="https://img.shields.io/npm/v/xithead?color=a855f7&label=npm&style=flat-square" alt="npm" /></a>
    <a href="https://discord.gg/xtream-itsolutions"><img src="https://img.shields.io/badge/Discord-Join-5865F2?style=flat-square&logo=discord&logoColor=white" alt="Discord" /></a>
    <a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-10b981?style=flat-square" alt="Apache 2.0" /></a>
  </p>
  <p>
    <a href="https://xtream-itsolutions.com">🌐 xtream-itsolutions.com</a> ·
    <a href="https://discord.gg/xtream-itsolutions">💬 Discord</a> ·
    <a href="https://github.com/xtream-itsolutions/xithead/issues">🐛 Bug melden</a>
  </p>
</div>

---

## Was ist xithead?

**xithead** ist ein lokaler Proxy von **[Xtream-ITSolutions UG](https://xtream-itsolutions.com)**, der sich zwischen Claude Code und die Anthropic API setzt. Er komprimiert Kontext aggressiv, cached Antworten und dedupliziert identische Requests — vollautomatisch, ohne Code-Änderungen.

```
Claude Code  ──►  xithead Proxy :8787  ──►  Anthropic API
                  │ Cache-Control
                  │ Context-Trim
                  │ Request-Dedup
                  └ Live Dashboard
```

**Ergebnis:** 50–95% weniger Token-Verbrauch, gleiche Qualität.

---

## Installation

### Windows (empfohlen — ein Befehl, alles automatisch)

```powershell
iex (irm https://raw.githubusercontent.com/xtream-itsolutions/xithead/main/headroom.ps1)
```

Das Skript installiert automatisch (ohne Adminrechte):
- Python 3.12, Node.js, Git (via Winget falls nicht vorhanden)
- xithead Python-Paket + Proxy-Abhängigkeiten
- xithead npm CLI + Claude Code
- Claude Code konfigurieren (`~/.claude/settings.json`)
- PowerShell-Profil mit allen Hilfsbefehlen

Danach nur noch eingeben (optional):
- Claude Login (Browser oder API-Key)
- GitHub Token (für Repo-Zugriff in Claude Code)

### npm (Windows / macOS / Linux)

```bash
npm install -g xithead
xithead
```

### pip (Python direkt)

```bash
pip install "xithead[proxy]"
python -m xithead.cli.main proxy --port 8787
```

---

## Benutzung

```powershell
xithead              # Claude Code mit Proxy starten (empfohlen)
xithead proxy        # Nur Proxy starten (mit Logs)
xithead stats        # Token-Einsparungen anzeigen
xithead update       # Alles aktualisieren (npm + Python)
xithead help         # Alle Befehle
```

### PowerShell-Hilfsbefehle (nach Installation)

```powershell
xithead-dashboard    # Dashboard im Browser öffnen
xithead-stats        # Einsparungen anzeigen
xithead-update       # Alles auf neuestem Stand halten
xithead-github       # GitHub Token + MCP Server einrichten
xithead-doctor       # System-Diagnose
xithead-help         # Alle Befehle
```

---

## Dashboard

Das Live-Dashboard läuft automatisch auf `http://localhost:8787/dashboard`:

- **Echtzeit-Statistiken** — Token gespart, Kosten, Cache-Hit-Rate
- **Request-Verlauf** — Token-Verbrauch pro Request als Chart
- **Einstellungen** — Komprimierungsstärke, Cache-Optionen
- **Installation** — Quick-Start Guide direkt im Browser

---

## Wie es funktioniert

| Feature | Beschreibung |
|---|---|
| **Cache Control** | Anthropic `cache_control` wird automatisch in jeden Request injiziert (bis zu 90% Einsparung bei Wiederholungen) |
| **Context Trimming** | Lange Konversations-Historien werden aggressiv komprimiert |
| **Request Deduplication** | Identische gleichzeitige Requests werden zusammengeführt |
| **429 Retry** | Automatisches Retry mit `Retry-After` Header bei Rate Limits |
| **SQLite Cache** | Persistenter Cache unter `~/.xithead/cache/` |

---

## Claude Code konfigurieren

xithead setzt `~/.claude/settings.json` automatisch während der Installation:

```json
{
  "env": {
    "ANTHROPIC_BASE_URL": "http://localhost:8787/v1",
    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "16000",
    "XITHEAD_ENABLE_CACHE_CONTROL": "1",
    "XITHEAD_ENABLE_DEDUP": "1",
    "XITHEAD_ENABLE_CONTEXT_TRIM": "1",
    "HEADROOM_STRENGTH": "aggressive"
  }
}
```

Damit nutzt auch `claude` direkt (ohne `xithead`-Wrapper) den Proxy.

---

## GitHub Integration

Claude Code kann direkt mit GitHub arbeiten (Repos lesen, PRs erstellen, Issues verwalten):

```powershell
xithead-github   # GitHub Token eingeben + MCP Server einrichten
```

Token erstellen unter: [github.com/settings/tokens/new](https://github.com/settings/tokens/new)  
Benötigte Scopes: `repo`, `workflow`, `read:org`

---

## Auto-Update

xithead prüft automatisch alle 6 Stunden auf neue Versionen:
- Neue npm-Version → stiller Hintergrund-Update
- Python-Paket → parallel aktualisiert

Manuelles Update jederzeit:
```powershell
xithead update       # oder
xithead-update       # PowerShell-Funktion
```

---

## Voraussetzungen

| Software | Version | Installiert durch |
|---|---|---|
| Python | ≥ 3.9 | Winget (automatisch) |
| Node.js | ≥ 18 | Winget (automatisch) |
| Claude Code | aktuell | npm (automatisch) |
| Git | aktuell | Winget (automatisch) |

---

## Lizenz

[Apache 2.0](LICENSE) — © 2026 [Xtream-ITSolutions UG](https://xtream-itsolutions.com)

---

<div align="center">
  <a href="https://discord.gg/xtream-itsolutions">💬 Discord</a> ·
  <a href="https://xtream-itsolutions.com">🌐 xtream-itsolutions.com</a> ·
  <a href="https://github.com/xtream-itsolutions/xithead">GitHub</a>
</div>
