API DOCS
Build against one free API.
Use the same key for chat, streaming, Messages API clients, model catalog browsing, image generation, and image edits.
Base setup
Base URL: https://api.freetheai.xyz/v1
Auth: Authorization: Bearer YOUR_API_KEY AUTH
Get a key
Join Discord and run /signup. Send the key as a bearer token.
If you lose it, run /resetkey.
Base URL: https://api.freetheai.xyz/v1
Auth: Authorization: Bearer YOUR_API_KEY ENDPOINTS
Supported routes
POST /v1/chat/completions OpenAI-compatible chat, streaming, tool calling, and multi-turn conversations. POST /v1/messages Anthropic-style Messages API for compatible clients and frameworks. GET /v1/models Authenticated model list for normal clients. GET /v1/models/full Expanded model catalog with tier metadata for catalog UIs. POST /v1/images/generations Image generation with img/gpt-image-2 and vhr/* generation models. POST /v1/images/edits Image editing with img/gpt-image-2 and a base64 data URL input image. GET /v1/health Public API health and catalog status. CHAT COMPLETIONS
OpenAI-compatible chat
Point OpenAI-compatible clients at https://api.freetheai.xyz/v1.
Use exact model aliases from /models.
curl
curl https://api.freetheai.xyz/v1/chat/completions \
-H "Authorization: Bearer $FREETHEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "glm/glm-5.1",
"messages": [
{ "role": "user", "content": "Write a tiny Flask route." }
],
"stream": true
}' JavaScript SDK
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.FREETHEAI_API_KEY,
baseURL: "https://api.freetheai.xyz/v1"
});
const res = await client.chat.completions.create({
model: "glm/glm-5.1",
messages: [{ role: "user", content: "Reply with OK." }]
});
console.log(res.choices[0].message.content); MESSAGES API
Anthropic-style clients
Use /v1/messages for clients that expect Anthropic-style request bodies.
curl https://api.freetheai.xyz/v1/messages \
-H "Authorization: Bearer $FREETHEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "rev/claude-sonnet-4.5",
"max_tokens": 256,
"messages": [
{ "role": "user", "content": "Give me a short implementation plan." }
]
}' MODEL CATALOG
List models
Use /v1/models for normal clients. Use /v1/models/full
when you need tier and catalog metadata for a UI.
Client catalog
curl https://api.freetheai.xyz/v1/models \
-H "Authorization: Bearer $FREETHEAI_API_KEY" Full catalog
curl "https://api.freetheai.xyz/v1/models/full" \
-H "Authorization: Bearer $FREETHEAI_API_KEY" IMAGES
Generate and edit images
Use /v1/images/generations for text-to-image. Use
/v1/images/edits only with img/gpt-image-2.
Generation responses may contain either b64_json or url,
so robust clients should support both.
img/gpt-image-2 Generation + editing Returns base64 image data. Use this for edits. vhr/flux_dev Generation only Text-to-image model. vhr/gpt_image_2 Generation only Text-to-image model. vhr/nano_banana_2 Generation only Text-to-image model. vhr/bytedance_seedream_v4 Generation only Text-to-image model. Image generation
curl https://api.freetheai.xyz/v1/images/generations \
-H "Authorization: Bearer $FREETHEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "vhr/gpt_image_2",
"prompt": "A cinematic neon sports car parked under rainy city lights"
}' Image edit
curl https://api.freetheai.xyz/v1/images/edits \
-H "Authorization: Bearer $FREETHEAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "img/gpt-image-2",
"prompt": "Improve this logo and make it cleaner",
"image": "data:image/png;base64,BASE64_IMAGE_HERE"
}' Python save helper
import base64
import os
from pathlib import Path
import requests
API_KEY = os.environ["FREETHEAI_API_KEY"]
API_BASE = "https://api.freetheai.xyz/v1"
def save_image_result(result, output_path):
item = (result.get("data") or [{}])[0]
if item.get("b64_json"):
Path(output_path).write_bytes(base64.b64decode(item["b64_json"]))
return
if item.get("url"):
image = requests.get(item["url"], timeout=120)
image.raise_for_status()
Path(output_path).write_bytes(image.content)
return
raise RuntimeError(f"No image found in response: {result}")
res = requests.post(
f"{API_BASE}/images/generations",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json={
"model": "vhr/gpt_image_2",
"prompt": "A clean product mockup on a dark desk",
},
timeout=180,
)
res.raise_for_status()
save_image_result(res.json(), "generated.png") ERRORS
Common responses
400 Invalid request body, missing prompt, unknown model, or unsupported media operation. 401 Missing or invalid API key. Run /signup or /resetkey. 403 The model is not available for your current access tier. 429 Rate limit or concurrency limit reached. Wait and retry. 5xx Provider or gateway failure. Retry once before reporting it in Discord.