Free.ai API
One API key. Every AI tool. Simple token billing.
How It Works
Get an API Key
Purchase tokens, then generate your sk-free- key
Call Any Endpoint
Chat, images, TTS, STT, music, translation — all one API
Pay in Tokens
One balance. Every tool costs tokens. Simple.
Quick Start
# Chat with AI
curl -X POST https://api.free.ai/v1/chat/ \
-H "Authorization: Bearer sk-free-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": "Hello!"}],
"model": "qwen7b"
}'
# Generate an image — self-hosted (free within daily allowance)
curl -X POST https://api.free.ai/v1/image/generate/ \
-H "Authorization: Bearer sk-free-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "A sunset over mountains", "model": "flux-schnell"}'
# Generate with a premium model (paid tokens only — FLUX Kontext, Seedream,
# Ideogram, Nano Banana, Gemini 3 Pro, etc.). Full list at /v1/providers.
curl -X POST https://api.free.ai/v1/image/generate/ \
-H "Authorization: Bearer sk-free-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "A sunset over mountains", "model": "premium/flux-pro/kontext"}'
# Generate a video (premium)
curl -X POST https://api.free.ai/v1/video/generate/ \
-H "Authorization: Bearer sk-free-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "A cat running in slow motion", "duration": 5, "model": "premium/kling-video/v2.6/pro/text-to-video"}'
# Text to speech
curl -X POST https://api.free.ai/v1/tts/ \
-H "Authorization: Bearer sk-free-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Hello world", "voice": "default", "model": "kokoro"}'
# Translate text
curl -X POST https://api.free.ai/v1/translate/ \
-H "Authorization: Bearer sk-free-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Hello world", "target": "es"}'
import requests
API_KEY = "sk-free-YOUR_KEY"
BASE = "https://api.free.ai"
HEADERS = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}
# Chat
r = requests.post(f"{BASE}/v1/chat/", headers=HEADERS, json={
"messages": [{"role": "user", "content": "Hello!"}],
"model": "qwen7b" # or "openai/gpt-4o", "anthropic/claude-sonnet-4", etc.
})
print(r.json()["choices"][0]["message"]["content"])
# Generate image — self-hosted (free within daily allowance)
r = requests.post(f"{BASE}/v1/image/generate/", headers=HEADERS, json={
"prompt": "A sunset over mountains",
"model": "flux-schnell", # or "premium/flux-pro/kontext" for paid tier
"aspect_ratio": "16:9"
})
print(r.json()["image_url"])
# Generate video (premium — see /v1/providers for the full list)
r = requests.post(f"{BASE}/v1/video/generate/", headers=HEADERS, json={
"prompt": "A cat running in slow motion",
"duration": 5,
"model": "premium/kling-video/v2.6/pro/text-to-video"
})
print(r.json()["video_url"])
# Text to speech
r = requests.post(f"{BASE}/v1/tts/", headers=HEADERS, json={
"text": "Hello world",
"model": "kokoro",
"voice": "af_heart"
})
print(r.json()["audio_url"])
# Transcribe audio
r = requests.post(f"{BASE}/v1/stt/transcribe/", headers=HEADERS, json={
"url": "https://example.com/audio.mp3",
"model": "whisper"
})
print(r.json()["text"])
const API_KEY = "sk-free-YOUR_KEY";
const BASE = "https://api.free.ai";
// Chat
const chat = await fetch(`${BASE}/v1/chat/`, {
method: "POST",
headers: { "Authorization": `Bearer ${API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
messages: [{ role: "user", content: "Hello!" }],
model: "qwen7b"
})
});
const data = await chat.json();
console.log(data.choices[0].message.content);
// Generate image — self-hosted (free within daily allowance)
const img = await fetch(`${BASE}/v1/image/generate/`, {
method: "POST",
headers: { "Authorization": `Bearer ${API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ prompt: "A sunset over mountains", model: "flux-schnell" })
});
// Premium image model (paid tokens) — full list at /v1/providers
const imgPro = await fetch(`${BASE}/v1/image/generate/`, {
method: "POST",
headers: { "Authorization": `Bearer ${API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ prompt: "A sunset over mountains", model: "premium/flux-pro/kontext" })
});
console.log((await img.json()).image_url);
ٽوڪين جي قيمت
Everything costs tokens. One balance for all tools. Same pricing whether you use the API or the website.
| Model | Type | Token Cost | License |
|---|---|---|---|
| Qwen 2.5 7B | Chat/Write/Code | Actual tokens used (input+output) | Apache 2.0 |
| FLUX.1 Schnell | Image Generation | 1,000 tokens/image | Apache 2.0 |
| Kokoro | Text to Speech | 1 token per 4 chars | Apache 2.0 |
| faster-whisper | Speech to Text | 4 tokens/second of audio | MIT |
| AudioLDM 2 | Music Generation | 2,000 tokens/track | Apache 2.0 |
| MadLAD-400 | Translation (450+ langs) | Actual tokens used | Apache 2.0 |
| Real-ESRGAN | Image Upscaling | 500 tokens/image | BSD |
| BRIA RMBG | Background Removal | 500 tokens/image | Apache 2.0 |
| CogVideoX | Video Generation | 5,000 tokens/video | Apache 2.0 |
| Demucs | Vocal Separation | 500 tokens/track | MIT |
Access GPT-4, Claude, Gemini, Llama, DeepSeek, and 340+ more models. Token cost is based on provider pricing converted to our tokens.
| Model | Provider | ~Tokens per message | Notes |
|---|---|---|---|
| GPT-4o Mini | OpenAI | ~20 | Cheap, fast |
| Gemini 2.0 Flash | ~15 | Very fast | |
| Mistral Nemo | Mistral | ~10 | Great value |
| DeepSeek V3 | DeepSeek | ~30 | Strong reasoning |
| Llama 3.3 70B | Meta | ~25 | Open weights |
| Claude Sonnet 4 | Anthropic | ~400 | Premium quality |
| GPT-4o | OpenAI | ~325 | Premium quality |
| Qwen 2.5 72B | Alibaba | ~40 | Large, capable |
Full list of 346+ models at /apps/. All use the same /v1/chat/ endpoint — just change the model parameter.
Self-hosted models: توھان استعمال ڪيل ٽوڪنز کي پورو ادا ڪريو. ڪو به مارڪ اپ نه.
External models: our_tokens = provider_usd_cost × 100,000 × 1.30
Example: GPT-4o costs $0.0025 per 1K prompt tokens. For 1,000 tokens: $0.0025 × 100,000 × 1.30 = 325 tokens from your balance.
All Endpoints
POST /v1/chat/ | Chat with any model (self-hosted or external). Streaming supported. |
POST /v1/image/generate/ | Text to image (FLUX, SDXL) |
POST /v1/image/edit/ | Inpaint, outpaint, style transfer |
POST /v1/image/enhance/ | 2x/4x وڌي (ريئل-ESRGAN) |
POST /v1/image/remove-bg/ | Remove background (BRIA RMBG) |
POST /v1/video/generate/ | Text/image to video (CogVideoX) |
POST /v1/tts/ | Generate speech (Kokoro, Piper, MeloTTS, Chatterbox) |
POST /v1/tts/stream/ | Streaming TTS (real-time audio chunks) |
POST /v1/stt/transcribe/ | آڊيو/وڊيو نقل ڪريو (فائر-ويشپر، 99 ٻوليون) |
POST /v1/music/generate/ | Generate music from text description |
POST /v1/music/separate/ | Separate vocals/stems (Demucs) |
POST /v1/write/ | Generate content (essay, email, story, etc.) |
POST /v1/code/generate/ | Generate code in any language |
POST /v1/summarize/ | Summarize text |
POST /v1/humanize/ | Make AI text sound human |
POST /v1/detect/ | Detect AI-generated content |
POST /v1/translate/ | متن جو ترجمو (MadLAD-400, 450+ ٻوليون) |
POST /v1/ocr/ | Extract text from images |
GET /v1/models | List all available models (self-hosted + external) |
GET /v1/status/{job_id}/ | Check async job status |
GET /health | API health check |
Authentication
Include your API key in the Authorization header:
Authorization: Bearer sk-free-YOUR_API_KEY
Every response includes a free_ai_usage block showing tokens used:
{
"choices": [...],
"free_ai_usage": {
"tokens_used": 142, // actual tokens processed
"tokens_charged": 142, // tokens deducted from your balance
"source": "self_hosted", // or "external"
"model": "qwen7b"
}
}
Rate Limits & Plans
Same token pricing on the website and API. No separate API pricing.
| Plan | Tokens/Month | API Requests/Min | Price |
|---|---|---|---|
| Free | 5K/day (pool) | 10 | $0 |
| Basic | 250K | 30 | $5/mo |
| Pro | 1.25M | 60 | $19/mo |
| Business | 6.25M | 120 | $49/mo |
| Enterprise | Custom | Custom | Contact |
ٽوڪين جا موجود پيڪيجز: 200K/$5، 1M/$15، 5M/$40. ٽوڪين جي مدت ڪڏهن به ختم نه ٿيندي.
Python SDK & CLI
Python SDK
Access every AI tool from your Python code.
pip install free-dot-ai
from freeai import FreeAI
ai = FreeAI(api_key="sk-free-xxx")
# Chat
response = ai.chat("What is Python?")
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"
GitHub
PyPI
CLI Coding Assistant
Free, open-source alternative to Claude Code, Cursor, and GitHub Copilot.
pip install free-dot-ai-code
# Start a coding session
cd your-project/
free-code
# Ask about your codebase
free-code ask "How does auth work?"
# Execute a task
free-code run "Add unit tests for User model"
5K free tokens/day. BYOK supported. 346+ models. Session sync with Web IDE.
GitHub PyPI Web IDEBYOK (Bring Your Own Key)
ڪنهن به فراهم ڪندڙ کان پنھنجيون API ڪُليون استعمال ڪريو. صفر مارڪ اپ، صفر فيس. Free.ai صرف درخواست پروڪيز ڪري ٿو.
| Provider | Key Format | Models | Markup |
|---|---|---|---|
| OpenAI | sk-proj-xxx | GPT-4o, GPT-4o Mini, o1, o3, etc. | $0 |
| Anthropic | sk-ant-xxx | Claude Sonnet 4, Opus 4, Haiku, etc. | $0 |
AIzaSyxxx | Gemini 2.5 Pro, Flash, etc. | $0 | |
| Other Providers | sk-or-xxx etc. | 346+ models from all providers | $0 |
# Python SDK with BYOK
from freeai import FreeAI
ai = FreeAI(provider="openai", api_key="sk-proj-xxx")
response = ai.chat("Hello", model="gpt-4o")
# CLI with BYOK
# free-code config set provider openai
# free-code config set api_key sk-proj-xxx
توھان جي ڪَچ، توھان جي استعمال، توھان جو بل. ڪو به لاگنگ. توھان جي Free.ai جي توازن مان ڪوبه ٽوڪِن جو گھٽايو نه.
API FAQ
"model": "openai/gpt-4o" or "model": "anthropic/claude-sonnet-4". Full list at /apps/ or GET /v1/models."stream": true in your chat request. Responses are delivered via Server-Sent Events (SSE).free_ai_usage.tokens_charged field in each API response.pip install free-dot-ai. It wraps every endpoint with typed responses. For coding assistance, install pip install free-dot-ai-code. The API also follows OpenAI's format, so you can use the openai Python/Node SDK with our base URL. GitHub