Free.ai Docs
Quickstart in 60 seconds.
OpenAI-compatible chat API. One Bearer token, 400+ tools. Run this curl, then read on.
curl https://api.free.ai/v1/chat/ \
-H "Authorization: Bearer sk-free-YOUR-KEY" \
-H "Content-Type: application/json" \
-d '{"model":"qwen2.5-7b","messages":[{"role":"user","content":"Hello!"}]}'
What do you want to build?
Quickstarts
Chat
POST /v1/chat/
{
"model": "qwen2.5-7b",
"messages": [
{"role": "user", "content": "Hello!"}
]
}
Image generation
POST /v1/image/generate/
{
"model": "flux",
"prompt": "a quiet cabin at dusk",
"width": 1024,
"height": 1024
}
Image edit
POST /v1/image/edit/
multipart:
image: <file>
prompt: "remove the chair"
operation: "edit"
Text to speech
POST /v1/tts/
{
"model": "kokoro",
"voice": "af_heart",
"text": "Hello there!"
}
Speech to text
POST /v1/stt/
multipart:
audio: <file>
model: "whisper-large-v3"
language: "auto"
Translate
POST /v1/translate/
{
"text": "Hello",
"target_lang": "es"
}
SDKs
Python
pip install freeai-code
Nodenpm i freeai-code
Go (coming)
Ruby (coming)
Or use the OpenAI SDK - point base_url at api.free.ai/v1
Recipes
FAQ
Sign up at /signup/, confirm your email, and open /account/?tab=api. Click Generate and a Bearer key (sk-free-...) appears. Save it - for security we only display the full key once.
JSON. The /v1/chat/ response mirrors the OpenAI shape: choices[].message.content for the text, plus a usage object that reports token cost. Audio + image endpoints return a JSON envelope with output_url, share_url, and credits_used.
Yes - pass stream:true on chat requests. Responses arrive as Server-Sent Events with the same data: {...} envelope as the OpenAI streaming protocol. The final message is data:[DONE].
Yes. Pass a tools array per the OpenAI tool-calling schema. Native-tool-call models return structured tool_calls; non-native models fall back to a JSON-mode prompt that emits the same shape.
Yes. Vision-capable chat models accept image_url content parts (URLs or base64). For STT, POST audio as multipart/form-data to /v1/stt/. For PDF, use /v1/pdf/extract/ to OCR and chat about the result.
A monthly call cap tied to your plan (1,000 free, 10,000 Basic, 100,000 Pro, 1M Business) plus your purchased token balance. There's no per-second throttle. The daily free pool only applies to web requests, not API calls.
freeai-code on npm + PyPI for our Coder IDE wrapper. For the raw API, the OpenAI SDKs (Python + Node) and most LLM frameworks (LangChain, LlamaIndex, Vercel AI SDK) work - set base_url to https://api.free.ai/v1 and your Bearer key.
We sign every webhook with HMAC-SHA256 over the raw body. The signature is in the X-Free-Signature header (hex-encoded). Reject any payload whose signature doesn't match HMAC(your_webhook_secret, raw_body).
{error:{message, type, code}}. 402 = out of credits (response includes upgrade URL + shortfall in tokens). 429 = daily pool exhausted (web only). 400 = validation error. 5xx = our problem; retry with exponential backoff.
The /v1/chat/ endpoint accepts the OpenAI ChatCompletion request schema and returns the same response shape. Most existing OpenAI client code works by changing two lines - base_url + api_key.
Yes - every self-hosted model is open-source (Apache 2.0 / MIT). Our gpu_api repo is public; clone it, supply your GPU, and run the same inference stack. For a managed private cloud install, contact us.
Self-hosted models run free on your 30,000-token daily pool, then bill the raw token count. Premium models are pay-as-you-go: 1.50× retail markup, dropping to 1.30× at $500/30d and 1.15× at $2,000/30d. Live cost is on every model page and on every API response; token top-ups start at $1.