Documentation · Getting started · Models · freetheai.org
FreeTheAI Python SDK
The official Python client for FreeTheAI, a free OpenAI-compatible AI API. One key gives you dozens of chat models, streaming, tool calls, web search with sourced answers, and image and video tasks.
pip install freetheai
Quickstart
Create a key at freetheai.org, do the daily check-in for free models, and set FREETHEAI_API_KEY.
from freetheai import FreeTheAI
client = FreeTheAI()
reply = client.chat.completions.create(
model="fta/zai/glm-5.3",
messages=[{"role": "user", "content": "Write a haiku about open models."}],
)
print(reply["choices"][0]["message"]["content"])
Stream it:
for text in client.chat.completions.stream_text(model="fta/kimi/k3", messages=messages):
print(text, end="", flush=True)
Search the web:
answer = client.answer("What changed in Python 3.14?")
print(answer["answer"], answer["sources"])
Built for the FreeTheAI API
Generic OpenAI clients treat every error the same. This one knows how the FreeTheAI API answers:
- Busy models wait for the server's
Retry-After, or move straight to yourfallback_models. - Concurrency limits are learned on the first refusal; extra calls queue instead of failing.
- Long replies are fetched as a stream and assembled, so they don't hit idle timeouts.
- Cut-off streams raise
StreamInterruptedErrorwith the partial text, never a silently short answer. - The daily check-in and daily limit raise
CheckinRequiredErrorandDailyLimitErrorat once, with the link or reset time. - Mistyped model IDs come back with suggestions; a missing
fta/prefix is fixed for you.
client = FreeTheAI(fallback_models=["fta/zai/glm-5.3-flash", "fta/mmx/minimax-m3"])
Read Reliability for the full list.
Documentation
| Guide | |
|---|---|
| Getting started | Key, check-in, first request |
| Chat and streaming | Parameters, streaming, reasoning, images |
| Tool calls | Function calling step by step |
| Web search | Results and sourced answers |
| Images and video | Media tasks |
| Async | AsyncFreeTheAI |
| Errors | Every error class and what to do |
| Configuration | All client options |
More from FreeTheAI
- JavaScript / TypeScript SDK and Go SDK
- Cookbook: runnable examples
- Setup guides for SillyTavern, JanitorAI, Claude Code, Cline, and more
- API status and Discord
License
MIT
Metadata
Release files for freetheai 0.1.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 | |
|---|---|---|---|
| freetheai-0.1.0.tar.gz | 355.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| freetheai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 373.4 kB
Release files / freetheai-0.1.0.tar.gz
| Download URL | freetheai-0.1.0.tar.gz |
|---|---|
| Size | 355.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de1714b5bcbb552c85d2dfe107f8cfadfece4079b1ec97e82c93a1362fea91e3
|
|
BLAKE2b-256 checksum How to use checksums |
49d8be247fb05a19894c7ee33a8eb7920ecd33ba821b54426c243034f68f2153
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.18
|
Release files / freetheai-0.1.0-py3-none-any.whl
| Download URL | freetheai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ccc034db1f92ea8835994f4a0e5b4a2d4eab6bac8abc80cf932cbe65b8d0f763
|
|
BLAKE2b-256 checksum How to use checksums |
0b0536b5d49ee318a3128373af165764b3ab49452cb8980adeac339263a25710
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.18
|