API Free.ai
Un allwedd API. Pob offeryn AI. Bil tocyn syml.
Sut mae'n Gweithio
Cyrchu Allwedd API
Prynu tocynnau, ac wedyn creu eich allwedd sk-free-
Galw unrhyw Ddiwedd
Chat, delweddau, TTS, STT, cerddoriaeth, cyfieithiadau: API un cyfan
Talu mewn Tocynnau
Un balans. Mae pob offeryn yn costio tocynnau. Syml.
Cychwyn Cyflym
# 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": "sdxl"}'
# 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": "sdxl", # 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: "sdxl" })
});
// 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);
Prisio Tocynnau
Mae popeth yn costio tocynnau. Un balans ar gyfer pob offeryn. Yr un pris os ydych yn defnyddio'r API neu'r wefan.
| Model | Math | Cost Tocyn | Trwydded |
|---|---|---|---|
| Qwen 3.6 35B | Chat/Ysgrifennu/Cod | Tocynnau gwirioneddol a ddefnyddir (mewnbwn+allbwn) | Apache 2.0 |
| FLUX.2 Bach | Creu Delwedd | 5,000 tocynnau/ddelwedd | Apache 2.0 |
| Kokoro | Testun i LeferyddComment | 1 tocyn am bob 4 nod | Apache 2.0 |
| faster-whisper | Speech to Text | 4 tocyn/eiliad o sain | MIT |
| AudioLDM 2 | Creu Cerddoriaeth | 2,000 tocynnau/trac | Apache 2.0 |
| MadLAD-400 | Cyfieithiad (450+ tudalen) | Tocynnau gwirioneddol a ddefnyddir | Apache 2.0 |
| Real-ESRGAN | Uwchraddio Delwedd | 500 tocyn/ddelwedd | BSD |
| BRIA RMBG | Gwaredu Cefndir | 500 tocyn/ddelwedd | Apache 2.0 |
| CogVideoX | Creu Fideo | 30,000 tocyn/fideo | Apache 2.0 |
| Stem Separator (Mel-Band RoFormer + SCNet) | Ailosod | 500 tocyn/trac | MIT + Apache-2.0 |
Cyrchu GPT-6, Claude, Gemini, Llama, DeepSeek a gweddill y modelau 575. Mae cost tocynnau yn seiliedig ar bris y darparwr wedi ei drosi i'n tocynnau.
| Model | Darparwr | ~Tocynnau y neges (500 i mewn, 300 allan) |
|---|---|---|
| GPT-4o-mini | OpenAI | ~286 |
| Mistral Nemo | Mistral | ~100 |
| Llama 3.3 70B Instruct | Meta | ~639 |
| Qwen2.5 72B Instruct | Qwen | ~337 |
| DeepSeek V3 | DeepSeek | ~493 |
| GPT-4o | OpenAI | ~4,781 |
Rhestr lawn o fathau 575 ar /models/. Defnyddia pob un yr un diweddfa /v1/chat/: newidiwch y paramedr model yn unig.
Modelau hunan- westeiedig: Mae'n rhaid i chi dalu'r tocynnau cywir a ddefnyddir. Dim marcio.
Modelau allanol: our_tokens = provider_usd_cost × 750,000 × 1.5
Enghraifft: GPT-4o cost $0.0025 per 1,000 prompt tokens, so 1,000 prompt tokens cost $0.0025 x 750,000 x 1.5 = 2,812 tokens from your balance.
Y marcio 1.5 yw'r gyfradd safonol. Mae cyfrifon gyda gwariant misol uchel yn talu un is.
Pob Diweddnod
POST /v1/chat/ | Chat gydag unrhyw fodel (ei hunan-westeiwr neu allanol). Cynhelir llif. |
POST /v1/image/generate/ | Testun i ddelwedd (FLUX, SDXL) |
POST /v1/image/edit/ | Mewn- ddelweddu, allan- ddelweddu, trosglwyddo arddull |
POST /v1/image/enhance/ | Uwchraddio 2x/4x (Real-ESRGAN) |
POST /v1/image/remove-bg/ | Gwaredu Cefndir |
POST /v1/video/generate/ | Testun/delwedd i fideo (CogVideoX) |
POST /v1/tts/ | Creu iaith (Kokoro, Piper, MeloTTS, Chatterbox) |
POST /v1/tts/stream/ | TTS Llifogydd (cymysgeddau sain amser real) |
POST /v1/stt/transcribe/ | Trosysgrifo sain/fideo (faster-whisper, 99 iaith) |
POST /v1/music/generate/ | Creu cerddoriaeth o ddisgrifiad testun |
POST /v1/music/separate/ | Serydd/Cyfarch ar wahân (Mel-Band RoFormer + SCNet) |
POST /v1/write/ | Creu cynnwys (esboniadau, e-bost, straeon, ac ati) |
POST /v1/code/generate/ | Creu cod mewn unrhyw iaith |
POST /v1/summarize/ | Crynodeb testun |
POST /v1/humanize/ | Gwneud i destun AI swnio fel dyn |
POST /v1/detect/ | Canfod cynnwys a gynhyrchir gan AI |
POST /v1/embeddings/ | Mewnosod testun: BGE-M3 yn rhagosodedig, neu "model": "embeddinggemma-2" ar gyfer EmbeddingGemma 2 (768 dims, dimensions 128 i 768, input_type query or document) |
POST /v1/translate/ | Cyfieithu testun (MadLAD-400, 450+ iaith) |
POST /v1/ocr/ | Echdynnu testun o ddelweddau |
GET /v1/models | List all available models (self-hosted + external) |
GET /v1/status/{job_id}/ | Gwirio cyflwr y swydd an- gydamseru |
GET /health | Gwirio iechyd API |
Dilysiant
Cynnwys eich allwedd API yn y pennawd Authorization:
Authorization: Bearer sk-free-YOUR_API_KEY
Mae pob ymateb yn cynnwys bloc free_ai_usage yn dangos tocynnau a ddefnyddir:
{
"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"
}
}
Terfynau a Phlanau Cyfradd
Y un pris tocyn ar y wefan a'r API. Dim pris API ar wahân.
| & Gwaredu Iaith | Tocynnau | Cais API/mis | Cais API/Munud | Pris |
|---|---|---|---|---|
| Am ddim | 30,000 y diwrnod (pool rhad ac am ddim) | 1,000 | 60 | $0 |
| Sylfaenol | 250,000 | 10,000 | 120 | $5 y mis |
| Proffesiynol | 1,250,000 | 100,000 | 300 | $19 y mis |
| Busnes | 6,250,000 | 1,000,000 | 600 | $49 y mis |
| Enterprise | Addasiedig | 1,000,000 yn rhagosodedig, wedi'i godi ar gais | 600 yn rhagosodedig, wedi'i godi ar gais | Cyswllt |
Pecynnau tocyn ar gael: 200K/$5, 1M/$15, 5M/$40. Ni ddaw tocynnau i ben byth.
Python SDK & CLI
PythonName
Cyrchu pob offer AI o'ch cod Python.
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"
PyPI
PyPI
Cynorthwyydd Amgodio CLI
Dewis amgen am ddim a ffynhonnell agored i Claude Code, Cursor, a GitHub Copilot.
# macOS / Linux
curl -fsSL https://free.ai/install.sh | sh
# Windows (PowerShell)
irm https://free.ai/install.ps1 | iex
# 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"
30K tokens free/day. BYOK supported. 575 models. Session sync with Web IDE.
PyPI Canllaw gosod a gosod GweBYOK (Dewch â' ch Allwedd Eich Hun)
Defnyddio eich allweddi API eich hun o unrhyw ddarparwr. Dim marcio, dim ffioedd. Free.ai dim ond dirprwyo' r cais.
| Darparwr | Fformat Allwedd | Modelau | Marcio |
|---|---|---|---|
| OpenAI | sk-proj-xxx | GPT-4o, GPT-4o Mini, o1, o3, ac ati | $0 |
| Anthropic | sk-ant-xxx | Claude Sonnet 4, Opus 4, Haiku, ac ati | $0 |
AIzaSyxxx | Gemini 2.5 Pro, Flash, ac ati | $0 | |
| Darparwyr Eraill | sk-or-xxx etc. | Modelau 575 o bob darparwr | $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
Eich allwedd, eich defnydd, eich bil. Dim cofnodi. Dim tynnu tocynnau o'ch balans Free.ai.
API FAQ
"model": "openai/gpt-4o" neu "model": "anthropic/claude-sonnet-4". Rhestr lawn yn /models/ neu GET /v1/models."stream": true yn eich cais sgwrsio. Darperir ymatebion drwy ddigwyddiadau a anfonir gan y gweinydd (SSE).free_ai_usage.tokens_charged yn bob ymateb API.pip install free-dot-ai. It wraps every endpoint with typed responses. For coding assistance, install pip install freeai-code. The API also follows OpenAI's format, so you can use the openai Python/Node SDK with our base URL. API docs