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+.
pip install freeflow-llmQuick Start
2Set Environment Variables
# 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
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.
client.chat_stream()
Stream the response chunk by chunk.
