Complete reference for Flask Code features and APIs
Flask Code is an AI-powered coding assistant that transforms multiple AI providers into a unified agent interface. It supports both graphical (Tkinter) and command-line interfaces, allowing developers to choose their preferred workflow.
Seamlessly switch between Gemini, Groq, and OpenRouter without restarting. Each provider can have its own API key stored securely.
Choose between a polished Tkinter desktop application or a powerful terminal-based chat interface based on your workflow needs.
Register multiple user accounts with PIN-based authentication. Each user's settings and preferences persist across sessions.
Store up to three API keys in dedicated slots and switch between them on-the-fly. Perfect for managing multiple accounts or providers.
Chat responses render with markdown formatting, code syntax highlighting, and code blocks for better readability.
Use built-in commands to register accounts, switch models, manage keys, and control the application without leaving chat.
| Component | Responsibility |
|---|---|
main.py |
Terminal chat entry point |
user-interface.py |
Tkinter GUI entry point |
engine.py |
Core chat processing and provider routing |
auth.py |
User registration and PIN authentication |
apikey_settings.py |
Per-user API key and provider preference storage |
gemini_client.py |
Gemini API integration |
groq_client.py |
Groq API integration |
openrouter_client.py |
OpenRouter API integration |
markdown_highlighter.py |
Markdown rendering and syntax highlighting |
API keys are stored in a YAML-formatted .apikeys file with three slots:
key_1: YOUR_GEMINI_API_KEY
key_2: YOUR_GROQ_API_KEY
key_3: YOUR_OPENROUTER_API_KEY
.apikeys to version control. It is already in .gitignore.
Use the /apikey command to switch between stored keys:
/apikey 1
/apikey 2
/apikey 3
Flask Code checks for the GEMINI_API_KEY environment variable if no keys are found in .apikeys:
set GEMINI_API_KEY=YOUR_KEY
python main.py
Default provider
Google's advanced AI model with multimodal capabilities.
Command: /model gemini
Setup: Get API key at Google AI Studio
Fast inference
Optimized for speed with various open-source models.
Command: /model groq
Setup: Get API key at Groq Console
Provider aggregator
Access dozens of models through one API.
Command: /model openrouter
Setup: Get API key at OpenRouter
| Command | Syntax | Description |
|---|---|---|
/register-as |
/register-as |
Opens a popup dialog to create a new user account |
/login-as |
/login-as <username> <password> |
Log in as an existing user |
/apikey |
/apikey <1|2|3> |
Switch to the specified API key slot |
/model |
/model <provider> |
Switch provider (gemini, groq, openrouter) |
/help |
/help |
Display all available commands |
/logout |
/logout |
Log out of the current account |
/exit |
/exit |
Close the application |
Solution: Ensure Tkinter is installed:
sudo apt-get install python3-tkVerify installation with: python -m tkinter
Solution:
.apikeys file exists in the Flask Code directorykey_1, key_2, key_3GEMINI_API_KEY environment variable as a fallbackSolution:
Solution: Reinstall dependencies:
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
.apikeys
Secret file containing API keys (git-ignored)
Format: YAML with keys key_1, key_2, key_3
⚠️ Never commit to Git
.apikeys_example
Template for new installations
Copy this to .apikeys and fill in your keys
✓ Safe to commit
apikey_settings.py
Per-user settings storage
Stores preferred provider and API key slot for each user
Created automatically after first login
requirements.txt
Python dependencies
Install with: pip install -r requirements.txt
Main: PyYAML 6.0+