API Documentation & Quickstart
Get started with the uncensored LLM API in minutes. This guide covers the OpenAI-compatible endpoint, authentication, and core integration patterns for developers.
Base URL and Authentication
Use https://api.glmdocs.com/v1 as your base URL. Pass your API key in the Authorization: Bearer header. You get a key immediately after signup. No phone number required. The key is unique per account. Replace the old key when you generate a new one. Keep your key secure.
curl https://api.glmdocs.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Explain how to parse JSON in Python"}]
}'Authentication is standard. Any OpenAI SDK works here. Change the base URL. Set the API key. That is all you need to do. Errors return standard HTTP codes. Use 401 for invalid keys. Use 402 for insufficient credit.
First Request with Python
Send your first prompt using the official Python SDK. Install the package. Set the base URL. Import the client. Call chat completions. The model ID is "uncensored". It handles text in, text out. No extra configuration needed. The response contains the generated text.
from openai import OpenAI
client = OpenAI(base_url="https://api.glmdocs.com/v1", api_key="YOUR_KEY")
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)This setup works for simple scripts. You can adjust parameters later. The model does not refuse lawful adult topics. It runs on our servers. You pay only for tokens used. Errors do not cost credit. Refusals are free.
Node.js Integration
Integrate with Node.js using the standard client. Set the environment variable. Initialize the client. Request completions. Handle the response. The code is straightforward. Use the same model ID. The SDK handles serialization. You get structured data.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.glmdocs.com/v1", apiKey: process.env.API_KEY });
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);Node.js users get the same latency. The API is synchronous by default. Streaming requires extra config. Error handling is critical. Catch network issues. Check rate limits. The base URL remains constant. Your key stays the same.
Streaming Responses
Enable streaming for real-time output. Set the stream flag. Receive chunks as they generate. The last chunk includes token usage. This helps track costs. SSE is supported. Parse the data stream. Display text incrementally. Users see progress immediately.
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Tell the story in second person."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)Streaming reduces perceived latency. It works with both Python and Node. Token counts appear at the end. Sum them for total usage. Errors interrupt the stream. Handle disconnections gracefully. The context window is large. Keep tokens in mind.
Function Calling and JSON Mode
Use function calling for structured outputs. Define tools in your request. The model returns valid JSON. Enable JSON mode for strict output. Set response_format to json_object. Temperature controls randomness. Top_p limits diversity. Stop sequences halt generation. Seed ensures reproducibility.
Presence and frequency penalties adjust repetition. Use them for coding tasks. Tools can pass images. Function args accept documents. No OCR detour needed. The model handles multimodal inputs. This is powerful for agents. Configure tools carefully. Test edge cases.
Rate Limits and Context
Rate limits are 300 requests per minute. Concurrent requests cap at 8. Request bodies must stay under 8 MB. The context window is 100,000 tokens. This includes prompt and completion. Max output is 16,000 tokens. Default output is 2,048 tokens. Set max_tokens to extend this.
Errors return clear codes. 401 means invalid key. 402 means no credit. 429 means rate limit. Check usage in the dashboard. Credit never expires. Prepaid balance covers all calls. Crypto only for top-ups. USDT or USDC.
Frequently asked questions
What is the base URL for the GLM docs API?
The base URL is HTTPS://api.glmdocs.com/v1. It works with any OpenAI-compatible SDK. You only need to change the base URL and set your API key.
How much context does the uncensored model support?
The model supports a 100,000 token context window. This includes both the input prompt and the generated completion. Maximum output per request is 16,000 tokens.
What happens if I hit the rate limit?
You will receive a 429 status code. The limit is 300 requests per minute and 8 concurrent requests. Wait a moment and retry. The API is designed for high-throughput usage.
Access starts with a form
Sign up, grab the token, update your base URL. Simple.