Free.ai API
One API key. Every AI tool. Simple token billing.
How It Works
Get an API Key
Sign up free. Your key starts with sk-free-
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
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"}'
# 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
r = requests.post(f"{BASE}/v1/image/generate/", headers=HEADERS, json={
"prompt": "A sunset over mountains",
"model": "flux-schnell",
"aspect_ratio": "16:9"
})
print(r.json()["image_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
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" })
});
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.
| 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 = OpenRouter price converted to our tokens with 30% markup.
| 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: You pay the exact tokens used. No markup.
OpenRouter models: our_tokens = openrouter_usd_cost × 100,000 × 1.30
Example: GPT-4o costs $0.0025 per 1K prompt tokens on OpenRouter. 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/ | Upscale 2x/4x (Real-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/ | Transcribe audio/video (faster-whisper, 99 languages) |
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/ | Translate text (MadLAD-400, 450+ languages) |
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 "openrouter"
"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 | 50K/day (pool) | 10 | $0 |
| Basic | 200K | 30 | $5/mo |
| Pro | 1M | 60 | $19/mo |
| Business | 5M | 120 | $49/mo |
| Enterprise | Custom | Custom | 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"
50K free tokens/day. BYOK supported. 346+ models. Session sync with Web IDE.
GitHub PyPI Web IDEBYOK (Bring Your Own Key)
Use your own API keys from any provider. Zero markup, zero fees. Free.ai just proxies the request.
| 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 | |
| OpenRouter | sk-or-xxx | 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
Your key, your usage, your bill. No logging. No token deductions from your Free.ai balance.
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