Skip to content

danielrosehill/Custom-License-Creator

Repository files navigation

Custom License Creator

An AI-powered web application that helps you create custom open-source licenses or find existing licenses that match your needs.

Features

  • Two Interface Options:
    • Chatbot Interface (recommended): Interactive conversation with code blocks and artifacts like Claude
    • Form Interface: Simple form-based generation for quick one-off licenses
  • BYOK (Bring Your Own Key): Use your own OpenRouter API key for complete privacy and access to multiple AI models
  • Smart Recommendations: AI analyzes your requirements and suggests existing licenses when appropriate
  • Custom License Generation: Creates tailored licenses when existing ones don't fit
  • Code Block Display: View generated licenses in copy-friendly code blocks
  • Download & Copy: Download license files or copy directly from code blocks
  • Conversational Refinement: Chat to refine and adjust licenses iteratively
  • Natural Language Interface: Describe your needs in plain English
  • Markdown Output: Generated licenses are formatted in markdown
  • Automatic File Saving: Licenses are automatically saved to local files

Installation

Prerequisites

  • Python 3.8 or higher
  • uv - Fast Python package installer (recommended)
    curl -LsSf https://astral.sh/uv/install.sh | sh
  • An OpenRouter API key (get one at openrouter.ai)

Setup

  1. Clone this repository:
git clone https://github.com/yourusername/Custom-License-Creator.git
cd Custom-License-Creator
  1. Make the run script executable:
chmod +x run.sh
  1. (Optional) Set up environment variables:
cp .env.example .env
# Edit .env and add your API key

That's it! The run.sh script will handle the rest (creating venv, installing dependencies, etc.)

Usage

Running the Application

Quick Start (Recommended)

Use the provided bash wrapper script that handles environment setup with uv:

./run.sh

This script will:

  • Check if uv is installed
  • Create a virtual environment (if needed)
  • Install/update all dependencies
  • Let you choose between Chatbot or Form interface
  • Launch the Gradio interface

Manual Start

Alternatively, you can run manually:

# With uv (Chatbot interface - recommended)
uv venv
uv pip install -r requirements.txt
uv run python app_chatbot.py

# Or use the Form interface
uv run python app.py

# Or with traditional pip
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
python app_chatbot.py  # or app.py for form interface

The application will be available at http://localhost:7860

Using the Interface

Chatbot Interface (Recommended)

  1. Enter your OpenRouter API key in the sidebar
  2. Add project details (optional): Project name, author, copyright year
  3. Start chatting: Describe what kind of license you need
  4. Refine iteratively: Ask follow-up questions or request changes
  5. Copy or Download: License appears in a code block - click to copy or download the file

Form Interface

  1. Enter your OpenRouter API key in the field
  2. Choose license type: Project-specific or boilerplate/template
  3. Describe your requirements in natural language
  4. Optional: Add project details (name, author, year) for copyright notices
  5. Click Generate License

Example Prompts

  • "I want a permissive license similar to MIT but with a no-warranty clause"
  • "I need a copyleft license that requires derivative works to be open source"
  • "Create a license that allows commercial use but prohibits military applications"
  • "I want something like Apache 2.0 but simpler and easier to understand"
  • "I need a license that requires attribution and doesn't allow sublicensing"

How It Works

The application uses Claude AI (via OpenRouter) to:

  1. Analyze your requirements described in natural language
  2. Search for existing licenses that match your needs
  3. Recommend established licenses when they fit (MIT, Apache, GPL, etc.)
  4. Generate custom licenses when existing ones don't meet your specific requirements
  5. Explain tradeoffs between your needs and recommended licenses

Output

  • For project-specific licenses:

    • Displayed in the interface
    • Saved to generated_licenses/ directory
    • Available for download
  • For boilerplate licenses:

    • Displayed in the interface for you to copy and reuse

Privacy and Security

  • Your API key is never stored - it's only used for the current session
  • All processing happens via OpenRouter - no data is stored on servers
  • Local file generation - licenses are saved locally on your machine
  • Open source - audit the code yourself

Project Structure

Custom-License-Creator/
├── app_chatbot.py           # Chatbot interface (recommended)
├── app.py                   # Form-based interface
├── run.sh                   # Bash launcher script (uv-based)
├── requirements.txt         # Python dependencies
├── system-prompt.md        # AI assistant instructions
├── .env.example            # Example environment variables
├── .gitignore             # Git ignore rules
├── README.md              # This file
└── generated_licenses/    # Auto-created directory for generated licenses

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is open source. Use it to create licenses for your own projects!

Acknowledgments

  • Built with Gradio
  • Powered by Claude AI via OpenRouter
  • Inspired by the need for flexible, understandable open-source licenses

About

AI tool to create a bespoke set of licensing terms for a project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published