/v1/chat/completionsGenerate a response
Send the conversation in messages and select the model by its exact ID. These examples use GLM 5.3 Flash.
Install the openai package and set UNCENSURED_API_KEY as shown in the quickstart.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://uncensuredai.com/v1",
api_key=os.environ["UNCENSURED_API_KEY"],
)
response = client.chat.completions.create(
model="glm-5.3-flash-abliterated",
messages=[{"role": "user", "content": "Scrivi un breve saluto in italiano."}],
reasoning_effort="low",
max_tokens=4096,
)
print(response.choices[0].message.content)The fields in the example
| Field | How to use it |
|---|---|
model | An exact model ID returned by GET /v1/models for your key. |
messages | A list of messages, each with role and content. |
max_tokens | The output budget, which can include reasoning tokens. The example uses 4096. |
reasoning_effort | A level supported by the selected model. GLM Flash uses low in this example. |
stream | Set to true to receive the response in successive chunks. |
OpenAI compatibility refers to Chat Completions. Images, tools, context limits and reasoning options depend on the model and client.
Read the response
The generated text is in choices[0].message.content. Check finish_reason to understand how generation ended and usage for the reported token counts.
print(response.choices[0].message.content)
print(response.choices[0].finish_reason)
print(response.usage)/v1/chat/completionsDisplay text as it arrives
Reuse the client from the Python example and enable streaming. Each event may contain only part of the response.
stream = client.chat.completions.create(
model="glm-5.3-flash-abliterated",
messages=[{"role": "user", "content": "Ciao!"}],
reasoning_effort="low",
max_tokens=4096,
stream=True,
)
for chunk in stream:
if chunk.choices:
text = chunk.choices[0].delta.content
if text:
print(text, end="", flush=True)
print()Some events have no text. Check choices and delta.content before displaying a chunk.
/v1/modelsFind the models available to your key
Reuse the Python client to list model IDs. This checks the connection without generating a reply.
models = client.models.list()
for model in models.data:
print(model.id)Availability comes from your authenticated model list. The public capabilities catalogue separately describes confirmed limits and reasoning settings.
Open the model capabilities catalogue