API Documentation
Get started with the uncensored coding API by pointing your OpenAI-compatible SDK to our base URL and authenticating with your prepaid API key.
Authentication and base URL setup
Start by generating your credential on the Get API key page using Google or email. The system displays your key immediately, and you can replace it anytime to revoke access. All requests target the standard /v1 endpoint structure. You do not need to configure complex headers, just pass the key in the Authorization header.
Our uncensored AI API key works with any library that supports OpenAI-compatible clients. Change the base URL to HTTPS://api.glmkey.com/v1 and inject your token. This setup mirrors standard integrations, ensuring your existing code routes correctly without vendor lock-in.
- Base URL: HTTPS://api.glmkey.com/v1
- Auth header: Authorization: Bearer YOUR_API_KEY
Chat completions endpoint reference
Send text to the model by posting JSON to the chat completions endpoint. The API expects a standard payload with model name, messages array, and optional parameters. You must specify uncensored as the model ID to ensure you access the correct large language model tuned for unrestricted output.
Errors like 401 indicate an invalid key, while 402 signals insufficient prepaid credit. The system charges only for actual token usage, so errors do not consume your balance. Use the following curl command to test the connection.
curl https://api.glmkey.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "List the endpoints for the glm key service"}]
}'
Python SDK integration
Install the official OpenAI library and configure it to point at our base URL. This allows you to use familiar Python patterns for generating text. The client handles serialization and retries automatically. You can pass parameters like temperature or top_p to control creativity.
The uncensored LLM accepts standard message formats. You can switch between system, user, and assistant roles just like you would with any other provider. The following Python snippet demonstrates a basic completion request.
from openai import OpenAI
client = OpenAI(base_url="https://api.glmkey.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)
Node SDK integration
Use the Node.js SDK to integrate the API key into your JavaScript or TypeScript projects. Set the apiKey and baseURL properties in the client configuration. This ensures all requests route to our servers instead of the default provider. You can then call chat.completions.create() with your desired parameters.
The uncensored coding API supports standard tool definitions and JSON modes. You can parse responses directly into your application logic. The following Node.js example shows how to initialize the client and send a simple message.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.glmkey.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);
Streaming responses and token counts
Enable streaming by setting stream: true in your request. The API returns Server-Sent Events (SSE) chunks. Each chunk contains partial content, and the final chunk includes the total token usage. This allows you to render text progressively in your UI.
The uncensored AI API key supports this feature without extra cost. You can monitor token consumption in real-time. The following snippet demonstrates how to handle streaming responses in Python.
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)
Rate limits and concurrency rules
You are limited to 300 requests per minute per key. Concurrency is capped at 8 simultaneous requests. The request body must not exceed 8 MB. These limits ensure stable performance for all prepaid users. If you exceed the rate, you receive a 429 error.
The context window supports up to 100,000 tokens for prompt and completion combined. Output is limited to 16,000 tokens per request. If you do not set max_tokens, the default is 2,048 tokens. Monitor your usage via the dashboard to avoid service interruptions.
FAQ
How do I get my glm key for the first time?
Sign up on the Get API key page using Google or email. The system displays your key immediately after registration. No phone number is required, and you receive $0.50 in trial credit valid for 7 days.
What happens if I exceed the 300 requests per minute limit?
The API returns a 429 Too Many Requests error. You must wait until the rate limit window resets. Concurrency is also limited to 8 simultaneous requests per key.
Is the uncensored model the same as GPT or Claude?
No. It is an open-weight model run on our own servers, tuned to answer without content refusals for lawful adult use. It is not GPT, Claude, Gemini, Grok, DeepSeek, Qwen, Llama, or any other vendor's model.
Generate your key now
Sign up, copy the key, update the base URL. That is the entire setup.