es ▾
Get your key

Quickstart: uncensored llm api integration

Integrate our uncensored LLM API using standard OpenAI-compatible code. This guide covers authentication, requests, and streaming with zero vendor lock-in.

Install your preferred OpenAI-compatible SDK

Start by installing the SDK for your language. Our API follows the openai standard, so you likely already have the tools. Use pip for Python or npm for Node.js.

  • Python: pip install openai
  • Node.js: npm install openai

This ensures compatibility with our /v1/chat/completions endpoint. You do not need a proprietary client library.

Configure base_url and api_key

Set your base URL to https://api.apikeyglm.com/v1. Pass your API key in the authorization header. This works with any OpenAI-compatible client by changing base_url and the API key. Keep your key secure in environment variables.

  • Base URL: https://api.apikeyglm.com/v1
  • Model ID: uncensored

No complex routing is required. Just point your SDK to this endpoint.

Send your first completion request

Make a POST request to /v1/chat/completions. The model ID is uncensored. You can send text prompts and receive text responses. This is a direct, uncensored LLM API for developers who want predictable output.

The context window supports 100,000 tokens total. Max output is 16,000 tokens per request. Set max_tokens to control length.

Enable streaming for real-time tokens

Enable streaming by setting stream: true. You receive Server-Sent Events (SSE). Token usage data appears in the last chunk. This reduces perceived latency for users. It is ideal for chat interfaces.

Parse the SSE stream to display tokens as they generate. The API handles the streaming protocol automatically.

Use function calling with tools

Supports function calling via tools and tool_choice. Pass a JSON schema for your functions. The model returns tool calls in the response. You execute the function and feed results back. This works with JSON mode (response_format: json_object) for structured data. Parameters like temperature and top_p are fully supported.

Handle rate limits and errors

Rate limit is 300 requests per minute per key. Concurrent limit is 8 requests. Request body max is 8 MB. Handle 401 for invalid keys. Handle 402 for no credit. Handle 429 for rate limits. Errors are free, so you only pay for successful tokens. No subscription fees apply. Credit never expires.

cURL

curl https://api.apikeyglm.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "List the steps to configure the proxy server"}]
  }'

Python

from openai import OpenAI

client = OpenAI(base_url="https://api.apikeyglm.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.js

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.apikeyglm.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

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)

Frequently asked questions

What is the glm apikey?

It is your unique authentication token for our uncensored API. Generate it on the dashboard. Use it in the <code>Authorization: Bearer</code> header. It grants access to the <code>uncensored</code> model.

Is this an OpenAI-compatible API?

Yes. It uses the same <code>/v1/chat/completions</code> endpoint. You can use any standard OpenAI SDK. Just change the base URL to our endpoint. No code changes are needed for basic requests.

How much does it cost?

$0.15 per 1M input tokens and $0.50 per 1M output tokens. Prepaid credit is charged by real usage. Errors and refusals are free. No monthly subscription is required.

Access in one step

Register, copy the key, update your base URL. Done.

Get your key