Documentation

Learn how to use Kai Browser and build extensions

Quick Links

Getting Started

Kai Browser is a Python-based browser where you can create custom extensions using natural language. Describe what you want, and AI builds it for you.

Note: Kai Browser is currently available for Linux only.

Installation

  1. Download Kai Browser from the home page or GitHub
  2. Extract the downloaded file
  3. Run ./kai-browser to start

Browser Interface

AI Extension Builder

Create browser extensions by describing what you want in plain English. No coding experience required.

How It Works

  1. Click the button in the toolbar
  2. Describe your extension (e.g., "Add a button that shows word count")
  3. Review the generated code
  4. Click "Add Extension" to install it

Tip: You can refine your extension. Ask it to "make the button blue" or "add a keyboard shortcut" after generation.

Setting Up API Keys

The AI builder requires an API key from one of these providers:

Add your key in Extension Builder → Settings. Keys are stored securely using your system's keyring.

Auto-Fix Errors

Enable "Auto-fix errors" to have the AI automatically attempt to fix loading errors. It will retry up to 3 times.

Extension Structure

Kai supports two patterns: Natural Pattern (simpler, for AI-generated code) and Legacy Pattern (more features, for complex extensions).

Natural Pattern (Simple)

Create a class with __init__ and activate methods:

from PyQt6.QtWidgets import QToolButton from PyQt6.QtGui import QAction class MyPlugin: def __init__(self, browser): self.browser = browser self.toolbar = browser.toolbar def activate(self): button = QToolButton() button.setText("🎯 My Button") button.clicked.connect(self.on_click) self.toolbar.addWidget(button) def on_click(self): print("Button clicked!")

Legacy Pattern (Full Features)

Extend KaiModule for state persistence and helper methods:

from PyQt6.QtGui import QAction from kai_base import KaiModule class MyExtension(KaiModule): def setup(self): action = QAction("🎯 My Button", self.browser_core) action.triggered.connect(self.on_click) self.add_toolbar_action(action) def on_click(self): if not self.enabled: return self.show_message("Hello!")

API Reference

Available methods when using the Legacy Pattern (KaiModule):

UI Methods

MethodDescription
add_button(text, on_click)Add toolbar button
add_menu_button(text, items, on_select)Add dropdown menu
add_input(placeholder, on_enter)Add text input
show_message(text, title, icon)Show message dialog
ask_text(prompt, default)Ask for text input
ask_yes_no(question)Ask yes/no question

Browser Access

Property/MethodDescription
self.browser_coreMain browser instance
self.browser_core.browserActive tab's web view
self.browser_core.get_current_url()Get current URL
self.browser_core.inject_javascript(script)Execute JS on page
self.browser_core.show_status(msg, timeout)Show status message

Event Handlers

MethodDescription
on_page_load(callback)Called when page loads
on_url_change(callback)Called when URL changes
set_interval(callback, seconds)Run repeatedly
run_in_background(callback, on_complete)Background thread

Preferences

MethodDescription
get_preference(key, default)Get saved value
set_preference(key, value)Save value

Marketplace

Share your extensions and discover community creations.

Installing Extensions

  1. Browse the Marketplace
  2. Click "Install" to download
  3. Place the .py file in your modules/ folder and restart kai browser or copy and paste the code into the code editor and click add extension (no restart is needed)

Uploading Extensions

  1. Sign in to your account
  2. Go to Upload Extension
  3. Fill in details and upload your .py file
  4. Submit for review (24-48 hours)

Note: The marketplace is in early development. Review extension code before installing from untrusted sources.

Troubleshooting

Extension Won't Load

Common PyQt6 Issues

# WRONG button.setPopupMode(PopupMode.InstantPopup) # CORRECT button.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)

AI Generation Issues

Data Storage

Kai stores data in ~/.kai_browser/:

To reset, delete the ~/.kai_browser/ folder.

Getting Help

Check GitHub Issues or open a new issue for support.