Skip to main content

FreeTheAI Python SDK

PyPI Python versions Tests MIT license Discord

Documentation · Getting started · Models · freetheai.org

FreeTheAI Python SDK

The official Python client for FreeTheAI, an AI model marketplace with one OpenAI-compatible API. One key reaches models from many providers, paid per token, with streaming, tool calls, web search with sourced answers, and image and video tasks.

pip install freetheai

Quickstart

Create a key at freetheai.org, add funds and follow a provider at freetheai.org/providers, and set FREETHEAI_API_KEY.

from freetheai import FreeTheAI

client = FreeTheAI()

reply = client.chat.completions.create(
    model="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="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 your fallback_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 StreamInterruptedError with the partial text, never a silently short answer.
  • The daily check-in and daily limit raise CheckinRequiredError and DailyLimitError at 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=["glm-5.3-flash", "minimax-m3"])

Read Reliability for the full list.

Documentation

Guide
Getting started Key, funds, 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

License

MIT

Metadata

Release files for freetheai 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for freetheai 0.1.1
File Size Uploaded Provenance Actions
freetheai-0.1.1.tar.gz 355.8 kB With provenance Details for freetheai-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for freetheai 0.1.1
File Interpreter ABI Platform Actions
freetheai-0.1.1-py3-none-any.whl Python 3 none any Details for freetheai-0.1.1-py3-none-any.whl

Total release size: 373.5 kB

Release files / freetheai-0.1.1.tar.gz

Download URL freetheai-0.1.1.tar.gz
Size 355.8 kB
Tags Source
SHA-256 checksum
How to use checksums
82dcc0eaaa6633b816c6ecbb2df87f358106fb72fcb42863501ac410203852c1
BLAKE2b-256 checksum
How to use checksums
aa3bb45453f37f1a8fba9ebc56a0d4d443e74055b6be74a7c6b978b47e116d26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Release files / freetheai-0.1.1-py3-none-any.whl

Download URL freetheai-0.1.1-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4323c2803f09104625d7a0a608a19fee8de0ae675d3de5574e709c0114fd628
BLAKE2b-256 checksum
How to use checksums
90e05f9b0dbf5f10ae356e0d7fccbe71404b71033eb80c488ad2920e62b3f212
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Security for freetheai 0.1.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for freetheai-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page