Developer Docs
Use your FreeLLMAPI key with OpenAI-compatible clients or Anthropic Messages-compatible clients.
Quickstart
OpenAI Base URL: https://api.freellmapi.ai/v1 Anthropic Base URL: https://api.freellmapi.ai Recommended model: glm-5.2 Fallback model: glm-4.7 Available OpenAI-format models: glm-5.2, glm-5.1, glm-4.7 New models: qwen3.8-max-preview, kimi-k3 API key: sk_live_xxx
OpenAI Python
from openai import OpenAI
client = OpenAI(
api_key="sk_live_xxx",
base_url="https://api.freellmapi.ai/v1",
)
resp = client.chat.completions.create(
model="glm-5.2",
messages=[{"role": "user", "content": "Write a Python script"}],
)
print(resp.choices[0].message.content)
OpenAI Node.js
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk_live_xxx",
baseURL: "https://api.freellmapi.ai/v1",
});
const resp = await client.chat.completions.create({
model: "glm-5.2",
messages: [{ role: "user", content: "Write a TypeScript helper" }],
});
console.log(resp.choices[0].message.content);
Anthropic Messages compatibility
Use this endpoint for clients that speak the Anthropic Messages API, including Claude-style coding clients. Supported model IDs such as kimi-k3 are routed to their native provider.
curl https://api.freellmapi.ai/v1/messages -H "x-api-key: sk_live_xxx" -H "anthropic-version: 2023-06-01" -H "content-type: application/json" -d '{
"model": "kimi-k3",
"max_tokens": 512,
"messages": [
{"role": "user", "content": "Write a Python helper"}
]
}'
# Claude-style clients ANTHROPIC_BASE_URL=https://api.freellmapi.ai ANTHROPIC_AUTH_TOKEN=sk_live_xxx
Current scope: text messages with Anthropic SSE streaming support. Tool use is not enabled yet. Unknown Anthropic model names continue to use the configured GLM compatibility target.
Endpoints
| Endpoint | Description |
|---|---|
GET /v1/models | List supported models. |
POST /v1/chat/completions | OpenAI-compatible chat completion endpoint. Use Authorization: Bearer sk_live_xxx. Streaming is not enabled yet. |
POST /v1/messages | Anthropic Messages-compatible endpoint for Claude-style clients. SSE streaming is supported; tool use is not enabled yet. |
GET /v1/billing/usage | Check token balance and recent usage for your API key. |
Chinese model providers
| Provider | Model line | Status on FreeLLMAPI | Notes |
|---|---|---|---|
| Z.ai / 智谱 | GLM-5.2, GLM-5.1, GLM-4.7 | Available now | Use glm-5.2 as the latest verified route. Use glm-4.7 as a fallback if upstream capacity is busy. |
| Alibaba Cloud / Qwen | Qwen 3.8 Max Preview | Available now | Use qwen3.8-max-preview for reasoning, coding agents, and long-context work. |
| DeepSeek | DeepSeek V3.2, DeepSeek V4 family | Roadmap | Candidate provider for reasoning, coding, and price-sensitive workloads. |
| Moonshot AI / Kimi | Kimi K3 | Available now | Use kimi-k3 with either OpenAI Chat Completions or Anthropic Messages. |