Skip to main content

๐Ÿš€ GPT Fusion

The Python toolkit that makes AI integration effortless

GPT Fusion is a comprehensive Python library designed to streamline AI-assisted application development. It ships a real LLM client for OpenAI-compatible chat completions (OpenAI, Groq, a local Ollama server, anything speaking the same API), plus the text processing, web scraping, and interactive demo tooling it's had all along.

๐ŸŽฏ Why Choose GPT Fusion?

  • ๐Ÿค– Real LLM Client: OpenAI-compatible chat completions, works with OpenAI, Groq, local Ollama, or anything else on that API shape
  • โšก Zero Setup Friction: Install and start coding in seconds
  • ๐Ÿ›ก๏ธ Production Ready: Built-in security, performance optimizations, and error handling
  • ๐Ÿ”Œ Modular Design: Use only what you need with optional dependencies
  • ๐Ÿ“š Rich Examples: Complete demo projects including Unity 3D games and auth systems
  • ๐Ÿงช Battle Tested: 80+ tests with 89%+ coverage and CI/CD pipeline

CI Python Version License Tests Coverage

๐Ÿ“ฆ Install from PyPI โ€ข ๐ŸŒ Live Documentation โ€ข ๐ŸŽฎ Try Live Demo

๐Ÿš€ Quick Start

๐Ÿ“ฆ Installation

Quick Install:

pip install gpt-fusion

Full Installation (all features):

pip install "gpt-fusion[all]"

Python Version Support:

  • โœ… Python 3.10+
  • โœ… Python 3.11 (Recommended)
  • โœ… Python 3.12

โšก Quick Start Example

import gpt_fusion

# ๐Ÿ”ค Smart text processing
text = "The quick brown fox jumps over the lazy dog"
print(f"Words: {gpt_fusion.word_count(text)}")
print(f"Reversed: {gpt_fusion.reverse_words(text)}")
print(f"Is palindrome: {gpt_fusion.is_palindrome('racecar')}")

# ๐Ÿ“Š Powerful data analysis
data = gpt_fusion.load_numbers_from_csv('data/sales.csv')
print(f"Average: {gpt_fusion.average_from_csv('data/sales.csv', use_streaming=True)}")

# ๐ŸŒ Easy web scraping (with built-in security)
headlines = gpt_fusion.scrape("https://news.ycombinator.com", "a.storylink")
print(f"Found {len(headlines)} headlines")

# ๐Ÿš€ Generate small, real starter projects in seconds
print(gpt_fusion.create_csv_app('my-analytics-dashboard', with_api=True))
print(gpt_fusion.create_tailwind_ui('my-modern-webapp', dark_mode=True))

Output:

Words: 9
Reversed: dog lazy the over jumps fox brown quick The
Is palindrome: True
Average: 1247.83
Found 30 headlines
my-analytics-dashboard
my-modern-webapp

๐Ÿค– LLM Integration

pip install "gpt-fusion[llm]"
export OPENAI_API_KEY=sk-...
from gpt_fusion import ask, LLMClient

# One-liner for a single question
reply = ask("Explain recursion in one sentence.")

# Or reuse a client across a multi-turn conversation
client = LLMClient(model="gpt-4o-mini")
reply = client.chat([
    {"role": "system", "content": "Answer in a single sentence."},
    {"role": "user", "content": "What's a closure?"},
])
client.close()

Points base_url anywhere that speaks the OpenAI chat completions API without changing your code. Verified working against Groq's free tier:

client = LLMClient(
    base_url="https://api.groq.com/openai/v1",
    model="llama-3.1-8b-instant",
    api_key=os.environ["GROQ_API_KEY"],
)

The same pattern works for a local Ollama server (base_url="http://localhost:11434/v1") or any other OpenAI-compatible endpoint.

๐ŸŽ›๏ธ Optional Feature Sets

Choose the components you need:

# ๐Ÿค– LLM chat completions client
pip install "gpt-fusion[llm]"

# ๐ŸŒ Web scraping & HTTP clients
pip install "gpt-fusion[web]"

# ๐Ÿš€ FastAPI backend with auto-docs
pip install "gpt-fusion[backend]"

# ๐Ÿฆ Social media integration
pip install "gpt-fusion[twitter]"

# ๐Ÿ› ๏ธ Asset optimization & building
pip install "gpt-fusion[build]"

# ๐Ÿงช Development tools
pip install "gpt-fusion[dev]"

# ๐ŸŽฏ Everything included
pip install "gpt-fusion[all]"

โœจ Features

๐Ÿค– LLM Client

Chat completions for OpenAI-compatible APIs - real requests, real error handling, no vendor lock-in.

# Install: pip install "gpt-fusion[llm]"
from gpt_fusion import ask, LLMClient

ask("Summarize the plot of Hamlet in two sentences.")

client = LLMClient()  # reads OPENAI_API_KEY from the environment
client.chat("Hello!", temperature=0.2)

Raises ConfigurationError if no API key is available, and APIError if the request fails or the response comes back in an unexpected shape - both importable from gpt_fusion.

๐Ÿ Python Utilities

Core text processing, math helpers, and CSV analysis tools.

import gpt_fusion

# Text processing
gpt_fusion.word_count("Hello world")  # 2
gpt_fusion.reverse_words("Hello world")  # "world Hello"
gpt_fusion.is_palindrome("racecar")  # True

# Math & CSV
gpt_fusion.average_from_csv("data.csv")
gpt_fusion.median_from_csv("data.csv")

๐ŸŒ Web Scraping

Simple web scraping utilities with BeautifulSoup integration.

# Install: pip install "gpt-fusion[web]"
import gpt_fusion

html = gpt_fusion.scrape("https://example.com")
# Returns clean text content

๐Ÿš€ FastAPI Backend

Ready-to-deploy API server with auto-generated docs.

# Install: pip install "gpt-fusion[backend]"
import uvicorn
import gpt_fusion

# Start server
uvicorn.run(gpt_fusion.backend_app, port=8000)

๐Ÿฆ Twitter Integration

Twitter bot utilities with OAuth support.

# Install: pip install "gpt-fusion[twitter]"
from gpt_fusion import TwitterBot

bot = TwitterBot(api_key, api_secret)
bot.tweet("Hello from GPT Fusion!")

๐ŸŽฎ Interactive Demos

๐Ÿ” Enhanced Auth UI Kit

Modern, secure authentication system with comprehensive security features:

  • ๐Ÿ›ก๏ธ Rate limiting & input sanitization
  • ๐ŸŽจ Beautiful glass-effect UI with dark mode
  • โ™ฟ WCAG 2.1 AA accessibility compliance
  • ๐Ÿ” Real-time password strength validation
  • ๐Ÿ“ฑ Fully responsive design

Try it: Enhanced Demo | Basic Version | Test Suite

๐ŸŽฏ Unity 3D Game Engine Integration

Complete game architecture demonstrating modern Unity patterns:

  • โšก Event-driven systems (no Update() polling)
  • ๐ŸŠ Object pooling for performance
  • ๐ŸŽ›๏ธ Scriptable Object configuration
  • ๐Ÿ–ฅ๏ธ Modern UI with smooth animations
  • ๐Ÿ—๏ธ Interface-based architecture

Explore: Modern Scripts | Setup Guide

๐Ÿ“Š Data Analysis Playground

High-performance CSV processing with streaming support for large datasets:

  • โšก Memory-efficient streaming for large files
  • ๐Ÿ“ˆ Statistical analysis (mean, median, percentiles)
  • ๐Ÿ”’ Built-in security (path traversal protection)
  • ๐Ÿ“‹ Sample datasets included
$ python examples/tutorial.py
๐Ÿ” Loading data/numbers.csv...
๐Ÿ“Š Values: [1.0, 2.0, 3.0, 4.0, 5.0]
๐Ÿ“ˆ Average: 3.0 | Median: 3.0
โšก Processing 1M rows in 2.3s (streaming mode)
โœ… Analysis complete!

Try: Tutorial Script | Sample Data

๐Ÿ› ๏ธ Project Generator

Small, real starter kits - not empty stubs, each command below actually runs and produces working code:

# ๐Ÿ“Š CSV demo script, plus a FastAPI wrapper over the same data
gpt-fusion create_csv_app my-analytics --with-api
# -> my-analytics/{app.py, numbers.csv, api.py}

# ๐ŸŽจ Tailwind + Firebase auth UI (--dark-mode for the glass-effect variant)
gpt-fusion create_tailwind_ui my-webapp --dark-mode
# -> my-webapp/{index.html, app.js}

# ๐Ÿš€ Both combined: a frontend/ + backend/ FastAPI app
gpt-fusion create_fullstack_app my-saas --auth --database
# -> my-saas/frontend/{index.html, app.js}
# -> my-saas/backend/{app.py, numbers.csv}

--auth adds a minimal HMAC-signed-token login flow (POST /login with demo/demo123, then a bearer token on every other route) and --database swaps reading the CSV live for a small SQLite-backed store - both demo-grade and clearly commented as such in the generated code, not production-hardened. Neither flag adds a new dependency beyond what gpt-fusion[backend] already needs.

(python -m gpt_fusion <command> ... works the same way as gpt-fusion <command> ... if you'd rather not rely on the installed console script.)

๐Ÿš€ API & Deployment

๐Ÿ’ป Local Development

Start the development server:

pip install "gpt-fusion[backend]"
uvicorn gpt_fusion.backend:app --reload --port 8000

Interactive Features:

  • ๐Ÿ“ Swagger UI: http://localhost:8000/docs
  • ๐Ÿ”ง ReDoc: http://localhost:8000/redoc
  • ๐Ÿ“Š Health Check: http://localhost:8000/health

๐ŸŒ API Endpoints

Method Endpoint Description Example
GET / Welcome message {"message": "gpt-fusion backend"}
GET /greet/{name} Personalized greeting /greet/Alice โ†’ {"message": "Hello, Alice! Welcome to gpt-fusion."}
GET /profile/{uid} Basic user profile {"uid": "42", "display_name": "User 42"}
GET /projects Available demo projects List with GitHub links
GET /health Liveness/version check {"status": "healthy", "version": "0.4.1"}

๐ŸŒ Cloud Deployment

๐Ÿš€ Deploy to Render (Recommended)

# render.yaml is included in the repo
git push origin main  # Auto-deploys via GitHub integration

๐ŸŸฃ Deploy to Heroku

# Procfile is included
heroku create my-gpt-fusion-app
git push heroku main

๐Ÿณ Deploy with Docker

FROM python:3.11-slim
WORKDIR /app
COPY . .
RUN pip install "gpt-fusion[backend]"
EXPOSE 8000
CMD ["uvicorn", "gpt_fusion.backend:app", "--host", "0.0.0.0", "--port", "8000"]

๐Ÿ› ๏ธ Troubleshooting

Common Issues

โŒ Installation fails on Python 3.9

# GPT Fusion requires Python 3.10+
pyenv install 3.11.0
pyenv local 3.11.0
pip install gpt-fusion

โŒ Import errors with optional dependencies

# Install specific feature sets
pip install "gpt-fusion[web]"  # for scraping
pip install "gpt-fusion[backend]"  # for FastAPI

โŒ CSV files not loading

# Ensure CSV has 'value' column header
import gpt_fusion
data = gpt_fusion.load_numbers_from_csv('data.csv', use_streaming=True)

๐Ÿ” Still having issues?

๐Ÿค Contributing

๐Ÿ› ๏ธ Development Setup

git clone https://github.com/costasford/gpt-fusion.git
cd gpt-fusion
pip install "gpt-fusion[dev]"  # Installs dev dependencies
pip install -e .  # Editable install
pre-commit install  # Git hooks for quality

๐Ÿงช Testing & Quality

# Run the full test suite (80+ tests)
pytest

# Check coverage (currently 89%+)
pytest --cov=src/gpt_fusion --cov-report=html

# Code formatting and linting
black .
flake8 .

# Run all quality checks
python scripts/run_checks.py

Project Structure

src/gpt_fusion/     # Main package
โ”œโ”€โ”€ core.py         # Basic utilities  
โ”œโ”€โ”€ llm.py          # LLM chat completions client (optional)
โ”œโ”€โ”€ text_utils.py   # Text processing
โ”œโ”€โ”€ analysis.py     # CSV/data tools
โ”œโ”€โ”€ web_scraper.py  # Web scraping (optional)
โ”œโ”€โ”€ backend.py      # FastAPI server (optional)
โ”œโ”€โ”€ twitter_bot.py  # Twitter integration (optional)
โ””โ”€โ”€ starter_kits.py # Project templates

tests/              # Comprehensive test suite
docs/               # Jekyll documentation
examples/           # Usage examples

Links

๐Ÿ“– GitHub Repository โ€ข ๐Ÿ“ฆ PyPI Package โ€ข ๐Ÿ› Report Issues โ€ข ๐Ÿ“„ MIT License


GPT Fusion - Practical demos of human-AI collaboration. Built with โค๏ธ and Python.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gpt_fusion-0.4.1.tar.gz (53.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gpt_fusion-0.4.1-py3-none-any.whl (46.9 kB view details)

Uploaded Python 3

File details

Details for the file gpt_fusion-0.4.1.tar.gz.

File metadata

  • Download URL: gpt_fusion-0.4.1.tar.gz
  • Upload date:
  • Size: 53.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for gpt_fusion-0.4.1.tar.gz
Algorithm Hash digest
SHA256 be2d7cd1c01f1de25d0edf5a0296af40f49e47ffb1cf12e41936f2d5e42ddb07
MD5 86dffbb085abac6eea1cd85e6a45a28a
BLAKE2b-256 9713c3107e390a1cd8cb258bb6d6ff9f9d4f05bf079b167bb4454318e8129e17

See more details on using hashes here.

Provenance

The following attestation bundles were made for gpt_fusion-0.4.1.tar.gz:

Publisher: publish-to-pypi.yml on costasford/gpt-fusion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gpt_fusion-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: gpt_fusion-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 46.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for gpt_fusion-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c99f078a13c547ea3378090d2730a9fb5af87531406e9657a3655c083cfac6c
MD5 9d288ccf8f8ff82ad6ffe04f2122e13a
BLAKE2b-256 782845b331212290de002bbc2ea2c79e6e07fe85e86d72eaa039fe007c2a66f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for gpt_fusion-0.4.1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on costasford/gpt-fusion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page