Skip to main content

AI On UI (aionui)

PyPI version License: MIT Python 3.10+ Code style: black

A powerful Python library for automating interactions with AI models (ChatGPT, Claude, Gemini) through their web interfaces. Supports both synchronous and asynchronous operations, file handling, and cross-platform compatibility.

Key Features

  • 🤖 Multiple AI Model Support:

    • ChatGPT
    • Claude
    • Gemini
  • 🔄 Dual Operation Modes:

    • Sync: for sequential code
    • Async: for asynchronous applications
  • 📦 Versatile Data Handling:

    • Text responses
    • Code blocks
    • JSON structures
    • Images
    • File upload/download
  • 🛠 Advanced Features:

    • Web search (ChatGPT)
    • Large file processing
    • Retry mechanism
    • Detailed logging
    • Cross-platform support

Installation

pip install aionui

Requirements

  • Python 3.10+
  • Google Chrome
  • Playwright

Quickstart

Synchronous Usage

from aionui import AiOnUi

# Initialize
aionui = AiOnUi()

# ChatGPT
with aionui.model_sync("gpt") as model:
    response = model.chat("Hello!")
    print(response)

# Claude
with aionui.model_sync("claude") as model:
    response = model.chat("Hello!")
    print(response)

# Gemini
with aionui.model_sync("gemini") as model:
    response = model.chat("Hello!")
    print(response)

Asynchronous Usage

import asyncio
from aionui import AiOnUi

async def main():
    aionui = AiOnUi()
    
    async with aionui.model_async("gpt") as model:
        response = await model.chat("Hello!")
        print(response)

# Run
asyncio.run(main())

Configuration

Create a config.yaml file:

# Chrome settings
chrome_binary_path: "/usr/bin/google-chrome"  # Path to Chrome binary
user_data_dir: "~/chrome-data"                # Profile directory
debug_port: 9222                              # Port to connect over devtools protocol

Use the config:

aionui = AiOnUi("config.yaml")

Advanced Examples

File Upload and Analysis

async with aionui.model_async("claude") as model:
    # Upload file
    await model.text_as_file("Content for analysis", "data.txt")
    
    # Analyze
    response = await model.chat("Analyze the uploaded data")
    print(response)

Web Search with ChatGPT

with aionui.model_sync("gpt") as model:
    response = model.chat(
        "Latest news about AI?",
        tools=["search_the_web"]
    )
    print(response)

JSON Response

with aionui.model_sync("gemini") as model:
    json_response = model.chat(
        "List 3 programming languages",
        expected_result="json"
    )
    print(json_response)

Documentation

See more examples and detailed guides in the examples directory.

Contributing

Contributions are welcome! See CONTRIBUTING.md for more details.

License

MIT License - see LICENSE for details.

Credits

Copyright (c) 2024 Vu Tri Anh Hoang - GitHub

Metadata

Release files for aionui 1.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aionui 1.4.2
File Size Uploaded
aionui-1.4.2.tar.gz 15.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aionui 1.4.2
File Interpreter ABI Platform
aionui-1.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 42.7 kB

Release files / aionui-1.4.2.tar.gz

Download URL aionui-1.4.2.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
aa60cf861327b34c7277657219562a6aa94fe8f50607f5b6a4c468b3fac5e271
BLAKE2b-256 checksum
How to use checksums
ded46df0986ece0bdd8bd4a73406feba362662b5171226cee4bd45ae1d276532
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Jun 29, 2025.

Transparency log

Release files / aionui-1.4.2-py3-none-any.whl

Download URL aionui-1.4.2-py3-none-any.whl
Size 27.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b6b6e74d63e2e1fc7e9f16d71f02373654caf1415b2e74a534aa2e6251f3be7
BLAKE2b-256 checksum
How to use checksums
e313be919d8de383e20811a7064e5f021d2f44babd668f7dab6a0370287db64e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Jun 29, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.4.2 This release

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.3

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page