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.
- Provider/Model Selection via Dropdown
Use the select box to choose a specific provider/model combination. - Pinning Provider/Model Combinations
After selecting a provider and model from the dropdown, click the pin button to add the combination to the pinned list. - Remove Pinned Combinations
Each pinned provider/model combination is displayed as a button. Clicking on the button removes it from the pinned list. - Send Requests to Multiple Providers
You can pin multiple provider/model combinations and send requests to all of them simultaneously, enabling fast and comprehensive content generation.
- Text and Code Generation
Enter prompts to generate text or code outputs. - Image Generation
Provide text prompts to generate images, which are shown as thumbnails. Clicking on a thumbnail opens the image in a lightbox view.
- Image Thumbnails
Generated images appear as small thumbnails within the conversation. - Lightbox View
Clicking a thumbnail opens the image in full size, along with the prompt used to generate it. - Automatic Image Download
You can enable automatic downloading of generated images through the settings.
- Message Reuse
While messages cannot be edited after sending, you can copy and reuse them. - Message Deletion
Individual messages or entire conversations can be deleted for a cleaner workspace. - Conversation List
The left sidebar displays a list of active and past conversations for easy navigation. - Change Conversation Title
By clicking the three dots next to a conversation title, you can either delete the conversation or change its title. - Backup and Restore Conversations
Backup and restore all conversations and messages as a JSON file (accessible via the settings).
- Speech Input
Use speech recognition to input prompts by speaking instead of typing. - Speech Output (Text-to-Speech)
The generated text can be read aloud using speech synthesis. - Custom Language Settings
Configure the language used for speech recognition to match your preference.
- Image Uploads
Upload images that will be appended to your message and sent to the AI provider. - Text File Uploads
Upload text files; their contents will be added to the message to provide more detailed input to the AI.
- DuckDuckGo Web Access
Enable web access through DuckDuckGo for privacy-focused browsing. - Theme Toggle
Switch between dark mode and light mode in the settings. - Provider Visibility
Hide unused providers in the settings using toggle buttons. - Log Access
View application logs, including error messages and debug logs, through the settings.
- Basic Authentication
You can set a password for Basic Authentication using the--g4f-api-key
argument when starting the web server.
- Automatic Detection of Truncated Responses
When using ChatGPT or HuggingChat providers, responses may occasionally be cut off or truncated. - Continue Button
If the GUI detects that the response ended abruptly, a Continue button appears directly below the truncated message. Clicking this button sends a follow-up request to the same provider and model, retrieving the rest of the message. - Seamless Conversation Flow
This feature ensures that you can read complete messages without manually re-prompting.
You can install the G4F GUI either as a full stack or in a lightweight version:
-
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.
-
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.
It is recommended to set a G4F_API_KEY
environment variable for authentication. You can do this as follows:
-
Linux/macOS:
export G4F_API_KEY="your-api-key-here"
-
Windows:
set G4F_API_KEY="your-api-key-here"
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.
Once the server is running, open your browser and navigate to:
http://localhost:8080/chat/
-
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.
-
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.
-
Generate Content
- Click the Generate button to produce the text, code, or images requested.
-
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.
-
Continue Button (ChatGPT & HuggingChat)
- 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.
-
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.
- Image Thumbnails: All generated images are shown as thumbnails within the conversation window.
- Lightbox View: Clicking any thumbnail opens the image in a larger view along with the associated prompt.
- Automatic Image Download: Enable this feature in the settings if you want images to be saved automatically.
-
API Key
Set your API key when starting the server by defining theG4F_API_KEY
environment variable. -
Provider Visibility
Hide any providers you don’t plan to use through the settings. -
Theme
Toggle between dark mode and light mode. Disabling dark mode switches to a white theme. -
DuckDuckGo Access
Optionally enable DuckDuckGo for privacy-focused web searching. -
Speech Recognition Language
Configure your preferred speech recognition language. -
Log Access
View logs (including error and debug messages) from the settings menu. -
Automatic Image Download
Enable this to have all generated images downloaded immediately upon creation.
-
Gallery Loading
Large images may take additional time to load depending on your hardware and network. -
Speech Recognition Accuracy
Voice recognition may vary with microphone quality, background noise, or speech clarity. -
Provider Downtime
Some AI providers may experience temporary downtime or disruptions.