AI-Picture-Generator
Text-to-image generator using g4f and Python with model selection and clipboard support
Links
README
From the repo.
AI Picture Generator
Script for generating images based on experiments with model selection
A convenient console tool for generating images based on a text description (promt) in Python using the g4f library. It supports several models: Bing, DeepAI, Flux and Pollinations.
Content
Functionality
-
Choosing a generation model
- Bing (recommended)
- DeepAI
- Flux
- Pollinations
-
The main cycle
-
User input of promt
-
Commands:
exit,выход,quit— terminate the script/model— change the model without restarting
-
-
Result generation and output
-
API request:
response = client.images.generate( model=model, prompt=prompt, response_format="url" ) image_url = response.data[0].url -
Auto-copying of the link to the clipboard (
pyperclip.copy) -
Beep on successful generation (
winsound.MessageBeep)
-
-
Error handling
-
Interception of exceptions and message output:
Generation error: <error text>
-
Requirements
- Python 3.7+
- Windows (for
winsoundoperation)
Dependencies
g4fpyperclipwinsound(included in the Windows standard library)
Installation
-
Clone the repository:
git clone https://github.com/KiriVoll/AI-Picture-Generator.git cd AI-Picture-Generator -
Install the dependencies:
pip install g4f pyperclip
Launch and Use
-
Run the script with the command:
python AIpictureGenerator.py -
At the first launch, select the generation model (1-4).
-
Enter the promt in the console and press Enter.
-
After generation:
- The link to the image will be copied to the clipboard.
- You will hear a beep.
-
To change the model, enter the command
/model. -
Use
quit,exitorвыходto exit.
Error Handling
The script intercepts all exceptions that occur when accessing the API and outputs them in a clear format. This allows you to continue working after an unsuccessful request.
Settings and Extensions
- Response formats: add support for
base64or byte data - GUI: implement a graphical interface with the
tkinterorPyQtlibraries - Logging: save the history of requests and responses to a file
- Parallel queries: implement batch generation of promts
❤️ Support
If you find this useful, feel free to star ⭐ the repo or share your improvements!
Collected info
- ★ 4 stars
- ⎇ 1 forks
- Language: Python
- Source updated: 7/4/2026
Config for your environment
Replace {MCP_ENDPOINT_URL} with this MCP’s endpoint URL (from its repo or docs above). No API key — you connect directly.
Tool
OS
Config file: ~/.cursor/mcp.json
{
"mcpServers": {
"mcp-server": {
"url": "{MCP_ENDPOINT_URL}"
}
}
}Paste into mcpServers in the config file. Restart Cursor after saving.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.