EN ▾
Get your key

Integrate the uncensored chat API

Start building with our uncensored LLM API by setting your base URL and key, then send text requests just like you would with OpenAI. This quickstart covers the essentials of integration, streaming, and error handling so you can get your project running immediately.

https://api.glmapiprice.com/v1uncensored

Set your base URL and API key

Use the provided base URL and a valid API key to connect your application. Our service is fully OpenAI-compatible, meaning you only need to change the base URL and authentication header in your existing client code. You do not need to rewrite your entire integration logic to switch to our uncensored model.

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

Generate your key via the dashboard using Google or email. Keep your key secure as it grants access to your prepaid credit.

Send your first chat completion request

Send a standard POST request to the chat completions endpoint to receive a text response. This is the most basic interaction and works with any OpenAI-compatible SDK. You provide a system prompt and user message, and the model returns the generated text.

curl https://api.glmapiprice.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Calculate cost for 50k tokens at current rate"}]
  }'

Ensure you specify the model ID as uncensored in your request body. This tells the API which model to use for the generation.

Integrate with the Python SDK

Use the official Python library to interact with the API programmatically. This approach handles JSON serialization and error handling automatically. You must configure the client with the correct base URL before making any calls.

from openai import OpenAI

client = OpenAI(base_url="https://api.glmapiprice.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 method is ideal for backend services or scripts where you need to process responses in Python. The SDK manages the HTTP connections efficiently.

Connect using the Node SDK

Implement the API in Node.js environments using the standard client library. This allows you to integrate the uncensored model directly into your JavaScript or TypeScript applications. Configure the base URL to point to our service.

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.glmapiprice.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 developers can use this to build serverless functions or full-stack applications. The syntax mirrors the OpenAI client, ensuring a smooth transition.

Enable streaming with SSE

Stream responses in real-time by setting the stream parameter to true. This sends chunks of text as they are generated, improving the user experience for chat interfaces. You receive the token usage statistics in the final chunk.

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 the perceived latency for users waiting for long answers. It is particularly useful for generating creative writing or code blocks.

Handle errors and check usage

Monitor your request limits and account status to avoid service interruptions. You may encounter a 401 error if the API key is invalid or expired. A 402 error indicates insufficient prepaid credit, requiring a crypto top-up. Rate limits return a 429 status if you exceed 300 requests per minute.

The context window allows up to 100,000 tokens for both prompt and completion. Errors and refusals do not consume your prepaid credit, ensuring you only pay for actual output.

Frequently asked questions

What is the glm API price for this uncensored model?

Our pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens. You only pay for what you use with prepaid credit, and there are no monthly subscription fees.

How do I get started with the API key?

Sign up using Google or email to receive your API key instantly. The key is displayed immediately after creation and can be used with any OpenAI-compatible client by updating the base URL.

What happens if I hit the rate limit?

You will receive a 429 status code if you exceed 300 requests per minute or 8 concurrent requests. Reduce your request frequency or distribute load across multiple API keys if necessary.

Secure your key now

Register, retrieve your key, and update your endpoint URL. That’s it.

Get your keyhttps://api.glmapiprice.com/v1