This is an OpenAI-compatible API proxy for Z.ai GLM-4.5, GLM-4.6, and GLM-4.5V models. It supports OpenAI API format with streaming and non-streaming responses.
OpenAI Base URL: http://localhost:9090/v1
All API requests must include a valid API key in the request header:
The default API key is sk-your-key. Change it with the DEFAULT_KEY environment
variable.
Returns the list of available models.
None
Generate model responses from a list of messages. Supports streaming and non-streaming modes.
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | yes | Model ID to use, e.g. "GLM-4.5" |
| messages | array | yes | List of messages containing role and content |
| stream | boolean | no | Whether to use streaming responses; default true |
| temperature | number | no | Sampling temperature to control randomness |
| max_tokens | integer | no | Maximum tokens to generate |
| Field | Type | Description |
|---|---|---|
| role | string | Message role: system, user, assistant |
| content | string | Message content |
The API uses standard HTTP status codes to denote success or failure:
| Status | Description |
|---|---|
| 200 OK | Request succeeded |
| 400 Bad Request | Request malformed or invalid parameters |
| 401 Unauthorized | API key invalid or missing |
| 502 Bad Gateway | Upstream service error |