Getting started¶
1. Install¶
Python 3.9 or newer. The only dependency is httpx.
2. Get a key¶
- Sign up at freetheai.org.
- Open API keys and create a key. It starts with
ftai_and is shown once, so copy all of it. - Free models need the daily check-in, one quick captcha a day.
The free tier is 50 requests a day, reset at 00:00 UTC. The plan page shows how to raise it.
Put the key in the environment:
3. Pick a model¶
Model IDs look like fta/<provider>/<model>. Browse them on freetheai.org/models or list them in code:
from freetheai import FreeTheAI
client = FreeTheAI()
for model in client.models.list():
print(model["id"])
4. Send a request¶
reply = client.chat.completions.create(
model="fta/zai/glm-5.3",
messages=[
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "What is an API gateway?"},
],
)
print(reply["choices"][0]["message"]["content"])
print(reply["usage"])
Replies use the OpenAI Chat Completions shape, returned as plain dictionaries.
Already using the OpenAI SDK?¶
FreeTheAI speaks the OpenAI wire format, so the openai package works with a different base URL:
from openai import OpenAI
client = OpenAI(base_url="https://api.freetheai.org/v1", api_key="ftai_...")
That gives you the plain client without the handling described on Reliability.