GPT4Free

G4F - GUI Documentation

Overview

The G4F GUI is a self-contained, user-friendly interface designed for interacting with multiple AI models from various providers. It allows users to generate text, code, and images effortlessly. Advanced features such as speech recognition, file uploads, conversation backup/restore, and more are included. Both the backend and frontend are fully integrated into the GUI, making setup simple and seamless.

Features

1. Multiple Providers and Models

2. Text, Code, and Image Generation

4. Conversation Management

5. Speech Recognition and Synthesis

6. File Uploads

7. Web Access and Settings

8. Authentication

9. Continue Button


Installation

You can install the G4F GUI either as a full stack or in a lightweight version:

  1. Full Stack Installation (includes all packages, including browser support and drivers):
    pip install -U g4f[all]
    
    • Installs all necessary dependencies, including browser support for web-based interactions.
  2. Slim Installation (does not include browser drivers, suitable for headless environments):
    pip install -U g4f[slim]
    
    • This version is lighter, with no browser support, ideal for environments where browser interactions are not required.

Setup

1. Setting the Environment Variable

It is recommended to set a G4F_API_KEY environment variable for authentication. You can do this as follows:

2. Start the GUI and Backend

Run the following command to start both the GUI and backend services based on the G4F client:

python -m g4f --debug --port 8080 --g4f-api-key $G4F_API_KEY

This starts the GUI at http://localhost:8080 with all necessary backend components running seamlessly.

3. Access the GUI

Once the server is running, open your browser and navigate to:

http://localhost:8080/chat/

Using the Interface

  1. Select and Manage Providers/Models
    • Use the select box to view the list of available providers and models.
    • Select a provider/model combination from the dropdown.
    • Click the pin button to add the combination to your pinned list.
    • To unpin a combination, click the corresponding pinned button.
  2. Input a Prompt
    • Enter your prompt manually or use speech recognition to dictate it.
    • You can also upload images or text files to include them in your prompt.
  3. Generate Content
    • Click the Generate button to produce the text, code, or images requested.
  4. View and Interact with Results
    • Text/Code: The generated response appears in the conversation window.
    • Images: Generated images are displayed as thumbnails. Click on any thumbnail to view it in full size within the lightbox.
  5. Continue Button
    • If a response is truncated, a Continue button will appear under the last message. Clicking it asks the same provider to continue the response from where it ended.
  6. Manage Conversations
    • Delete or rename any conversation by clicking the three dots next to its title.
    • Backup/Restore all your conversations as a JSON file in the settings.


Settings Configuration

  1. API Key
    Set your API key when starting the server by defining the G4F_API_KEY environment variable.

  2. Provider Visibility
    Hide any providers you don’t plan to use through the settings.

  3. Theme
    Toggle between dark mode and light mode. Disabling dark mode switches to a white theme.

  4. DuckDuckGo Access
    Optionally enable DuckDuckGo for privacy-focused web searching.

  5. Speech Recognition Language
    Configure your preferred speech recognition language.

  6. Log Access
    View logs (including error and debug messages) from the settings menu.

  7. Automatic Image Download
    Enable this to have all generated images downloaded immediately upon creation.


Known Issues

  1. Gallery Loading
    Large images may take additional time to load depending on your hardware and network.

  2. Speech Recognition Accuracy
    Voice recognition may vary with microphone quality, background noise, or speech clarity.

  3. Provider Downtime
    Some AI providers may experience temporary downtime or disruptions.


Return to Documentation