GLM Chat API
Chat Completions, streaming, and usage for Official Group GLM text models.
Use an Official Group APIPool key. The endpoint is
https://app.apipool.dev/v1/chat/completions. Confirm that your model is available
in the GLM catalog before calling it.
Models and protocol
This guide covers glm-5, glm-5.1, glm-5.2,
glm-5.3, and glm-5.3-flash. Use the Chat Completions messages format;
do not substitute these models into the quickstart's Responses example.
Non-streaming request
Set the APIPOOL_API_KEY environment variable, then run:
curl https://app.apipool.dev/v1/chat/completions \
-H "Authorization: Bearer $APIPOOL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"glm-5.3-flash","messages":[{"role":"user","content":"Reply only: APIPOOL-OK"}],"stream":false}'Replace model with another available model listed above. Read the answer from
choices[0].message.content and check choices[0].finish_reason; HTTP 200 alone
does not establish that the answer is complete. The response's usage contains
metering information. Current rates are on the selected model's detail page.
Streaming request
curl -N https://app.apipool.dev/v1/chat/completions \
-H "Authorization: Bearer $APIPOOL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"glm-5.3-flash","messages":[{"role":"user","content":"Reply only: APIPOOL-OK"}],"stream":true}'The response is SSE. Parse each JSON data: event, concatenate
choices[].delta.content, inspect the finish reason, and keep reading until
data: [DONE]. Disconnecting early may leave the reply incomplete; usage
already incurred is still billed. Usage may arrive in a final chunk, so do not
stop reading after the first text fragment.
Input, output, and cache rates are listed on each model's detail page. Reasoning
fields are not the final answer; read message.content or streaming
delta.content. When a request fails, retain the X-APIPool-Request-Id response
header or error.request_id from the error body for troubleshooting.