Chat (LLM)
xbrush_chatSend chat messages to an XBrush-hosted LLM and receive the completion text directly, without polling. Supports OpenAI-compatible models like GLM 5.2.
Instructions
Chat with an XBrush-hosted LLM (OpenAI-compatible chat completions, e.g. GLM 5.2). SYNCHRONOUS — returns the completion text directly; no request_id polling needed. The platform gateway cuts responses at ~30s, so keep outputs short: prefer the default reasoning_effort (none) or 'minimal' and a modest max_tokens. On a 504 gateway timeout the request usually STILL completes and bills server-side — recover the text with xbrush_list_requests + xbrush_get_request (failed requests are auto-refunded).
Args: model (string, required): e.g. z-ai/glm-5.2. See xbrush_list_models(category='text'). messages (array, required): 1-1000 of {role: system|user|assistant, content: string ≤1M chars}. max_tokens (int, optional): 1-65536, includes reasoning tokens. temperature (float, optional): 0-2. top_p (float, optional): 0-1. frequency_penalty / presence_penalty (float, optional): -2 to 2. reasoning_effort (string, optional): none/minimal/high/max. Default: none (fastest).
Billed per token (input/output/cached rates via xbrush_list_models). OpenAI params not listed above (tools, stop, n, seed, response_format, stream) are not supported.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | LLM model ID (e.g. z-ai/glm-5.2). Use xbrush_list_models with category='text' to see options and per-token pricing. | |
| top_p | No | Nucleus sampling probability mass (0-1). | |
| messages | Yes | Conversation so far, oldest first (1-1000 messages). The completion answers the last user message. | |
| max_tokens | No | Upper bound on generated tokens (1-65536), reasoning included. Keep modest — the response must finish within the ~30s gateway limit. | |
| temperature | No | Sampling temperature (0-2). Higher = more random. | |
| presence_penalty | No | Penalize tokens already present (-2 to 2). | |
| reasoning_effort | No | Reasoning budget for reasoning-capable models. Server default: none (fastest). Higher efforts can exceed the ~30s gateway limit — prefer none/minimal here. | |
| frequency_penalty | No | Penalize frequent tokens (-2 to 2). |