1from glm import glm
2
3# Initialize with your API key
4client = glm(api_key="glm-xxxxxxxx")
5
6# Create a chat completion
7response = client.chat.completions.create(
8 model="gpt-5",
9 messages=[{
10 "role": "user",
11 "content": "Hello, world!"
12 }],
13 temperature=0.7,
14 max_tokens=1024,
15 stream=True
16)
17
18for chunk in response:
19 print(chunk.choices[0].delta.content, end="")