Free.ai Python SDK
Access hundreds of AI tools from your Python code. Chat, image generation, text to speech, translation, video, music, and more.
Website | API Docs | PyPI | CLI Tool
Install
pip install free-dot-ai
Quick Start
from freeai import FreeAI
ai = FreeAI(api_key="sk-free-xxx") # or FreeAI() for anonymous
# Chat on a self-hosted model — free, no key needed, within the daily pool
response = ai.chat("What is Python?")
print(response.text)
# A premium model (anything with a provider prefix) needs purchased tokens.
# Free and anonymous callers get InsufficientCreditsError here, and the
# message tells you the cost, your balance and the shortfall.
response = ai.chat("Explain quantum computing", model="openai/gpt-4o")
print(response.text)
# Image generation
image = ai.image("A sunset over mountains")
image.save("sunset.png")
# Text to speech
audio = ai.tts("Hello world", voice="af_heart")
audio.save("hello.mp3")
# Translation
result = ai.translate("Hello", to="es")
print(result.text) # "Hola"
# Speech to text
transcript = ai.stt(url="https://example.com/audio.mp3")
print(transcript.text)
# Music generation
music = ai.music("Upbeat jazz piano")
music.save("jazz.mp3")
# Video generation
video = ai.video("A cat walking through a garden")
video.save("cat.mp4")
BYOK (Bring Your Own Key)
Use your own API keys from any provider. Zero markup.
# OpenAI
ai = FreeAI(provider="openai", api_key="sk-proj-xxx")
response = ai.chat("Hello", model="gpt-4o")
# Anthropic
ai = FreeAI(provider="anthropic", api_key="sk-ant-xxx")
response = ai.chat("Hello", model="claude-sonnet-4")
# Google
ai = FreeAI(provider="google", api_key="AIzaSyxxx")
response = ai.chat("Hello", model="gemini-2.5-pro")
# OpenRouter (346+ models)
ai = FreeAI(provider="openrouter", api_key="sk-or-xxx")
response = ai.chat("Hello", model="meta-llama/llama-3.3-70b")
Or via environment variables:
export FREEAI_API_KEY=sk-proj-xxx
export FREEAI_PROVIDER=openai
ai = FreeAI() # picks up env vars automatically
All Methods
| Method | Description | Returns |
|---|---|---|
ai.chat(message, model=...) |
Chat with any LLM | ChatResponse |
ai.image(prompt, model=...) |
Generate an image | ImageResponse |
ai.tts(text, voice=..., model=...) |
Text to speech | TTSResponse |
ai.stt(url=..., model=...) |
Speech to text | STTResponse |
ai.translate(text, to=...) |
Translate text | TranslateResponse |
ai.music(prompt, duration=...) |
Generate music | MusicResponse |
ai.video(prompt, model=...) |
Generate video | VideoResponse |
ai.enhance_image(url, scale=2) |
Upscale image 2x/4x | ImageResponse |
ai.remove_background(url) |
Remove image background | ImageResponse |
ai.models() |
List available models | list |
ai.health() |
API health check | dict |
Response Objects
Every response has:
- Typed attributes (
.text,.url, etc.) .usage— token usage info (.tokens_used,.tokens_charged,.source,.model).raw— the full JSON response dict
Media responses (image, tts, music, video) have a .save(path) method to download the file.
Models
Self-Hosted (cheapest)
| Model | Type | ID |
|---|---|---|
| Qwen 2.5 7B | Chat | qwen7b |
| Qwen 2.5 Coder 32B | Code | qwen-coder-32b |
| FLUX.1 Schnell | Image | flux-schnell |
| Kokoro | TTS | kokoro |
| faster-whisper | STT | whisper |
| MadLAD-400 | Translation | madlad400 |
| AudioLDM 2 | Music | audioldm2 |
| CogVideoX | Video | cogvideox |
OpenRouter (346+ models)
Use the provider/model format:
ai.chat("Hello", model="openai/gpt-4o")
ai.chat("Hello", model="anthropic/claude-sonnet-4")
ai.chat("Hello", model="google/gemini-2.5-pro")
ai.chat("Hello", model="meta-llama/llama-3.3-70b")
ai.chat("Hello", model="deepseek/deepseek-chat-v3")
Full list: free.ai/models/ or ai.models()
Pricing
- Anonymous: Daily free limits (no API key needed)
- Free account: 50K tokens/day (sign up)
- Paid plans: From $5/month (pricing)
- BYOK: $0 — your key, your bill, zero markup
Error Handling
from freeai import FreeAI, AuthenticationError, RateLimitError, InsufficientCreditsError
ai = FreeAI(api_key="sk-free-xxx")
try:
response = ai.chat("Hello")
except AuthenticationError:
print("Bad API key")
except InsufficientCreditsError:
print("Out of tokens — buy more at free.ai/pricing/")
except RateLimitError:
print("Too many requests — slow down")
Free.ai Ecosystem
- Free.ai — hundreds of free AI tools on the web
- Python SDK —
pip install free-dot-ai(you are here) - CLI Coder —
pip install freeai-code— AI coding in your terminal - iOS App — Native iPhone/iPad app
- Android App — Native Android app
- API Docs — Full API reference
- Web IDE — Code in your browser
License
MIT
Metadata
Release files for free-dot-ai 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| free_dot_ai-0.3.0.tar.gz | 15.9 kB | Without provenance | Details for free_dot_ai-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| free_dot_ai-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for free_dot_ai-0.3.0-py3-none-any.whl |
Total release size: 30.5 kB
Release files / free_dot_ai-0.3.0.tar.gz
| Download URL | free_dot_ai-0.3.0.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f42a567cf970b4501c9e05191c80f77523445488a8dd5b3cdc6374a5a9b92d29
|
|
BLAKE2b-256 checksum How to use checksums |
ec688ca7711fc8f7de4a8cec26c739bae80a7560adaea785e121df2a29d5d52d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|
Release files / free_dot_ai-0.3.0-py3-none-any.whl
| Download URL | free_dot_ai-0.3.0-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5db47f0ff64d8eda4b4315798c397c76aa728fabc62f11dcdf89833bf777873
|
|
BLAKE2b-256 checksum How to use checksums |
b3eb72eb518f2413d759e438bce85902d40d91878172e1138a2170d1e449c34a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|
Security for free-dot-ai 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.