Introduction

The FreeFlow package acts as an intelligent intermediary layer between your code and various AI providers. You simply provide multiple free API keys for your preferred services. FreeFlow intelligently handles rate limiting by first rotating through available keys within the same provider. If a provider is fully exhausted, it seamlessly switches to the next available provider. This strategy maximizes your continuous uptime and ensures you get the most out of every free tier without writing any complex logic.

Installation

Install the package via pip. Requires Python 3.9+.

Terminal
pip install freeflow-llm

Quick Start

1Get API Keys

ProviderLimitLink
Groq~14k req/dayGet Key →
Gemini1.5k req/dayGet Key →

2Set Environment Variables

.env
# Linux/macOS
export GROQ_API_KEY='["gsk_key1...", "gsk_key2..."]'
export GEMINI_API_KEY='["AIzaSy...", "AIzaSy..."]'

# Windows (PowerShell)
$env:GROQ_API_KEY='["gsk_key1...", "gsk_key2..."]'
$env:GEMINI_API_KEY='["AIzaSy...", "AIzaSy..."]'

3Run Your First Chat

main.py
from freeflow_llm import FreeFlowClient

# Initialize client (automatically finds keys in env)
with FreeFlowClient() as client:
    response = client.chat(
        messages=[
            {"role": "user", "content": "Explain quantum computing in one sentence."}
        ]
    )
    
    print(f"AI: {response.content}")

Advanced Usage

Streaming Responses

Perfect for chat interfaces where you want to show text as it generates.

with FreeFlowClient() as client:
    stream = client.chat_stream(
        messages=[{"role": "user", "content": "Write a story..."}]
    )
    
    for chunk in stream:
        print(chunk.content, end="", flush=True)

Multiple Keys (Higher Limits)

Pass a JSON list of keys to automatically rotate through them.

export GROQ_API_KEY='["key_1", "key_2", "key_3"]'

API Reference

client.chat()

Send a message and get a complete response.

chat(messages: list, temperature: float = 1.0, max_tokens: int = None) -> Response

client.chat_stream()

Stream the response chunk by chunk.

chat_stream(messages: list, ...) -> Iterator[Response]

Frequently Asked Questions

Do I need all provider keys?
No! You only need at least one key. However, adding more providers increases your redundancy and total rate limits.
Is it really free?
Yes. It relies entirely on the generous free tiers provided by platforms like Groq and Google. We just automate the connection.
Can I use it in production?
We do not recommend using FreeFlow for production workloads. It is perfect for building MVPs, prototyping ideas, and exploring the magic of LLMs and fine-tuning without cost.