Free.ai API

One API key. Every AI tool. Simple token billing.

How It Works

1
Get an API Key

توکي واخلئ، بيا خپل sk-free- کيلۍ توليد کړئ

2
Call Any Endpoint

Chat, images, TTS, STT, music, translation — all one API

3
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);

Token Pricing

Everything costs tokens. One balance for all tools. Same pricing whether you use the API or the website.

Self-Hosted Models Cheapest
بېلګهډولتوکي لګښتمنښتليک
Qwen ۲.۵ ۷بChat/Write/CodeActual tokens used (input+output)Apache 2.0
چټکانځور جوړول1,000 توکي/انځورApache 2.0
کوکوروText to Speech1 توکي په هر 4 لوښهApache 2.0
چټک-ويې ويلSpeech to Textد غږيزو 4 توکي / ثانيهMIT
غږيزLDM ۲ټنګټکور توليد2000 توکي / پلټنهApache 2.0
ماډلاډ-۴۰۰ژباړه (450+ سره)Actual tokens usedApache 2.0
:د رغښتل شويو پاڼو شمېرانځور لويول500 توکي / انځورBSD
برياشاليد ړنګول500 توکي / انځورApache 2.0
کوګ وېډيوXويډيو جوړول5,000 توکي / ویډیوApache 2.0
ډيمکسغږيز بېلونهKCharselect unicode block name500 توکي / پلټنهMIT
External Models 346+ models

Access GPT-4, Claude, Gemini, Llama, DeepSeek, and 340+ more models. Token cost is based on provider pricing converted to our tokens.

بېلګهبرابروونکیهرې استوزې لپاره توکييادښتونه
_کوچنی_پرانيستلAI~20ارزانه، چټک
Gemini ۲.۰ فلشګوګل~15ډېر چټک
نېمو_د_~10لوی ارزښت
DeepSeek V3DeepSeek~30قوي استدلال
Llama ۳.۳ ٧٠بميټا~25پرانيستل وزنونه
4 _فرې_ټېم_۱__انسان~400د لوړې کچې کیفیت
_د_پرانيستلAI~325د لوړې کچې کیفیت
Qwen ۲.۵ ٧٢ بعلي بابا~40لوی، توانمن

د 346+ ماډلونو بشپړ لیست په /apps/ کې. ټول د ورته /v1/chat / پای ټکی کاروي - یوازې د ماډل پارامتر بدل کړئ.

Token Formula

Self-hosted models: You pay the exact tokens used. No markup.

: بهرني بېلګه 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 = ۳۲۵ توکي from your balance.

All Endpoints

Chat / LLM
POST /v1/chat/Chat with any model (self-hosted or external). Streaming supported.
Image
POST /v1/image/generate/Text to image (FLUX, SDXL)
POST /v1/image/edit/Inpaint, outpaint, style transfer
POST /v1/image/enhance/Upscale 2x/4x (Real-ESRGAN)
POST /v1/image/remove-bg/Remove background (BRIA RMBG)
Video
POST /v1/video/generate/Text/image to video (CogVideoX)
Text to Speech
POST /v1/tts/Generate speech (Kokoro, Piper, MeloTTS, Chatterbox)
POST /v1/tts/stream/Streaming TTS (real-time audio chunks)
Speech to Text
POST /v1/stt/transcribe/Transcribe audio/video (faster-whisper, 99 languages)
Music & Audio
POST /v1/music/generate/Generate music from text description
POST /v1/music/separate/Separate vocals/stems (Demucs)
Text Tools
POST /v1/write/Generate content (essay, email, story, etc.)
POST /v1/code/generate/Generate code in any language
POST /v1/summarize/ليکنه لنډيزول
POST /v1/humanize/Make AI text sound human
POST /v1/detect/Detect AI-generated content
Translation & OCR
POST /v1/translate/Translate text (MadLAD-400, 450+ languages)
POST /v1/ocr/Extract text from images
Utility
GET /v1/modelsList all available models (self-hosted + external)
GET /v1/status/{job_id}/Check async job status
GET /healthAPI health check

Authentication

ستاسو API کيلي په Authorization سريز کې شامل کړئ:

Authorization: Bearer sk-free-YOUR_API_KEY

هر ځواب د free_ai_usage بلاک شامل دی چې کارول شوي توکي ښیې:

{
  "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.

پلانتوکي/مياشتAPI Requests/Minنرخ
وړیا5K / ورځ (د کلي)10$0
بنسټيز250K30$5/مياشت
د1.25M60$19/مياشت
سوداګري6.25M120$49/مياشت
شرکتدوديزدوديزContact

Token packs available: 200K/$5, 1M/$15, 5M/$40. Tokens never expire.

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 وړیا توکي / ورځ. BYOK ملاتړ شوی. 346+ ماډلونه. د ویب IDE سره سمون.

GitHub PyPI Web IDE

BYOK (Bring Your Own Key)

Use your own API keys from any provider. Zero markup, zero fees. Free.ai يوازې د غوښتنې proxies.

برابروونکیکيلۍ بڼهبېلګهنښونه
پرانيستلAIsk-proj-xxxGPT-4o, GPT-4o Mini, o1, o3, etc.$0
انسانsk-ant-xxxClaude Sonnet 4, Opus 4, Haiku, etc.$0
ګوګلAIzaSyxxxGemini 2.5 Pro, Flash, etc.$0
نور برابروونکيsk-or-xxx etc.د ټولو چمتو کونکو څخه 346+ ماډلونه$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

Yes! Free accounts get 5K tokens/day plus a 10K signup bonus. Paid plans offer more tokens and higher rate limits.

No! Same tokens, same pricing. Your token balance is shared between the website and API. Use either, pay the same.

Same endpoint, just change the model parameter. For example: "model": "openai/gpt-4o" or "model": "anthropic/claude-sonnet-4". Full list at /apps/ or GET /v1/models.

هو! د / v1 / chat / پای ټکی د OpenAI چیټ بشپړولو بڼه تعقیبوي. تاسو کولی شئ د OpenAI سره مطابقت لرونکي SDK وکاروئ - یوازې د اساس URL بدل کړئ https://api.free.ai او ستاسو د Free.ai API کلیدي وکاروئ.

Yes! Set "stream": true in your chat request. Responses are delivered via Server-Sent Events (SSE).

You'll get a 402 response with an error message. Buy more tokens at /pricing/ or wait for your daily free pool to reset. Self-hosted models are always available within daily limits.

Yes! All self-hosted models are MIT/Apache 2.0 licensed. Generated content is yours for commercial use.

Self-hosted: runs on our GPU. Cheapest, fastest, most private. External: proxied to the model provider. Access to GPT-4, Claude, Gemini, and more. Costs more tokens due to provider API fees.

Visit your account page at /account/ or check the free_ai_usage.tokens_charged field in each API response.

Yes! Install our Python SDK: 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

We aim for 99.9% uptime. Enterprise plans include SLA guarantees. Check /health for real-time status.

Email hello@free.ai or visit /contact/. Pro+ plans get priority support. Error responses include an error_id for debugging.

Free.ai مینه؟ خپل ملګرو ته ووایاست!

دا مخ کچول