Setup Guide

Step-by-step guide to install and configure Flask Code

1 Setup

Follow these steps to get Flask Code up and running on your system.

Prerequisites
  • Python 3.10 or later installed on your system
  • pip package manager (usually included with Python)
  • Valid API keys from at least one supported provider
Installation Steps
Step 1: Install Python Dependencies
python -m pip install -r requirements.txt
Step 2: Create API Keys File
copy .apikeys_example .apikeys
Step 3: Configure Your API Keys

Edit the .apikeys file and replace placeholder values with your actual API keys from:

Step 4: Add Launcher Scripts (Optional)

Add these PowerShell scripts to a folder in your PATH for convenient access:

  • flaskc.ps1
  • flaskcode.ps1
  • flck.ps1
  • bin/launch.py (for GUI)

2 API Key Format

Note: Flask Code expects .apikeys in YAML format with specific key names.
YAML Format

The .apikeys file should contain three API key slots in this format:

key_1: AIabc123...
key_2: AIdef456...
key_3: AIghi789...
How Keys Are Used
  • key_1, key_2, key_3 are provider slots that can hold any API key
  • You can use the same provider for multiple slots or mix different providers
  • key_3 is commonly used for OpenRouter as a fallback
  • The app also checks the GEMINI_API_KEY environment variable as an extra key source
  • Comment lines starting with -! are supported and ignored
Example Configurations

Multi-Provider Setup:

key_1: gemini_api_key_here
key_2: groq_api_key_here
key_3: openrouter_api_key_here

Single Provider (Multiple Accounts):

key_1: gemini_account_1_key
key_2: gemini_account_2_key
key_3: gemini_account_3_key

3 Launch Options

Terminal Mode

Run Flask Code in the terminal for a command-line chat interface:

python main.py

Perfect for server environments or users who prefer terminal workflows.

GUI Mode

Launch the Tkinter graphical interface:

python user-interface.py

Requires Tkinter to be installed. Offers a polished desktop experience.

Using Launcher Scripts

If you've added scripts to PATH, you can launch from anywhere:

flaskcode        # Launch GUI
flaskc           # Launch terminal
flck             # Short alias for terminal

4 Basic Commands

Use the chat prompt and built-in commands to control the app. Commands are prefixed with a forward slash.

Command Syntax Purpose
/register-as /register-as Create a new user account (opens popup)
/login-as /login-as <name> <password> Log in to an existing account
/apikey /apikey <1|2|3> Switch to API key slot 1, 2, or 3
/model /model <name> Change AI provider (gemini, groq, openrouter)
/help /help Display all available commands
/logout /logout Log out of the current account
/exit /exit Close the application
Command Examples
> /register-as
>> /login-as alice mypin
>> /model gemini
>> /apikey 2
>> What's the best Python practice for error handling?
>> /logout
>> /exit

5 Provider Tips

Gemini (Default)

Command: /model gemini

Strengths:

  • Advanced reasoning
  • Free tier available
  • Multimodal support
Groq

Command: /model groq

Strengths:

  • Very fast inference
  • Open-source models
  • Cost-effective
OpenRouter

Command: /model openrouter

Strengths:

  • Access many models
  • Easy provider switching
  • Unified pricing
Switching Between Providers
> /model gemini
>> How do I optimize this code?
[Gemini responds...]

>> /model groq
>> /apikey 2
>> What about performance?
[Groq responds...]

6 Common Troubleshooting

Issue: Running python user-interface.py produces no window

Solution:

  • Ensure Tkinter is installed: python -m tkinter
  • On Windows: Reinstall Python and check "tcl/tk and IDLE"
  • On Linux: sudo apt-get install python3-tk

Issue: "FileNotFoundError" or "YAML parse error"

Solution:

  • Copy the template: copy .apikeys_example .apikeys
  • Replace placeholder values with real API keys
  • Verify YAML formatting (colons, spacing)
  • Ensure file is in the Flask Code root directory

Issue: "ModuleNotFoundError" when running

Solution:

python -m pip install --upgrade pip
python -m pip install -r requirements.txt

7 Release Guidance

Guidelines for sharing Flask Code with others or deploying to production.

Security Best Practices
  • Keep .apikeys private and ensure it remains excluded by .gitignore
  • Share .apikeys_example but never share the real .apikeys file
  • Include this guide and README.md in your repository for new users
  • Document any custom modifications you've made
.gitignore Checklist

Ensure your .gitignore includes:

.apikeys
__pycache__/
*.pyc
*.pyo
.env
venv/

8 Recommended GitHub Setup

Steps to prepare Flask Code for version control and team collaboration.

Repository Structure
flask-code/
├── README.md              # Project overview
├── Guide.md               # This setup guide
├── main.py                # Terminal entry point
├── user-interface.py      # GUI entry point
├── requirements.txt       # Dependencies
├── .apikeys_example       # Template (safe to commit)
├── .apikeys               # NEVER commit!
└── .gitignore             # Include .apikeys
Initial Setup Steps
  1. Add README.md and Guide.md to the repository root
  2. Keep .gitignore updated with .apikeys
  3. Include requirements.txt for dependency management
  4. Create a .apikeys_example template for new users
  5. Push to GitHub with clear documentation
✓ Ready to Share! Your Flask Code repository is now ready for team collaboration.
Quick Reference
Installation
pip install -r requirements.txt
copy .apikeys_example .apikeys
# Edit .apikeys with your keys
Launch
python main.py      # Terminal
python user-interface.py  # GUI
flaskcode            # If in PATH