# GLM 5.4 API (reAPI)

## Overview

- What it does: Use GLM 5.4 through reAPI Chat Completions. Official Z.AI OpenAPI parameters, forced deep thinking, streaming tool calls, multimodal URLs, and dated checks.
- Vendor: Z.AI
- Category: chat
- Wire model id: `glm-5.4`
- Endpoint: `POST https://api.reapi.ai/v1/chat/completions` (Bearer auth; synchronous, OpenAI-compatible — no task polling)
- Landing page: https://reapi.ai/models/glm-5-4
- API key: create one at https://reapi.ai/settings/apikeys and send it as `Authorization: Bearer YOUR_API_KEY`

## Group pricing: glm-5.4

Current reAPI group prices from the same snapshot as the model page, in USD per 1 million tokens.
Default group: glm.

| Group | Model ID | Token type | USD per 1M tokens |
| --- | --- | --- | ---: |
| glm | glm-5.4 | input | $0.98 |
| glm | glm-5.4 | output | $3.08 |
| glm | glm-5.4 | cacheRead | $0.182 |


## Pricing

The summary prices below use each model’s default group listed above.

Current reAPI prices from the same quote as the model page, in USD. 1 credit = $0.001. Successful delivered requests are settled from actual usage/cost; no per-request whole-credit rounding is applied to token prices. No task polling or automatic retry is required.
- reAPI price quote fetched at: 2026-12-06T13:00:12.854Z (UTC).
- Price refresh interval: 300 seconds. Fetch this URL again after the cache expires to obtain updated prices and discounts.

### Official price comparison

Official reference: [Anthropic pricing](https://docs.z.ai/guides/overview/pricing), checked 2026-12-04. Standard input and output tokens, USD per 1 million tokens; not Batch, Priority, cache, or long-context pricing.

| Token type | Official price / 1M | Current reAPI price / 1M | Discount vs official |
| --- | ---: | ---: | ---: |
| Input | $1.4 | $0.98 | 30% |
| Output | $4.4 | $3.08 | 30% |

GLM 5.4 is currently 30% off official pricing for standard input and output tokens. Formula: (1 - current reAPI rate / official rate) × 100. This discount is already included in the reAPI prices; do not apply it again.

Cache reads, cache writes and any long-context tiers have their own published rates below. Do not assume the input/output discount applies to them. Official reference prices have a separate verification date; current reAPI prices refresh at the interval above.

- tokens / input: $0.98 per 1M tokens
- tokens / output: $3.08 per 1M tokens
- tokens / cacheRead: $0.182 per 1M tokens

## Calling this model

Synchronous and OpenAI-compatible: point any OpenAI SDK at the base URL below and use the wire model id. Responses return in the same HTTP call — there is no task id and nothing to poll.

- Base URL: `https://api.reapi.ai/v1`

## Input schema

Kept 1:1 with the live request validator; constraints are enforced server-side too. All media inputs are public HTTP(S) URLs — base64 and `data:` URIs are rejected platform-wide.

- `model` (string, required, default "glm-5.4")
- `messages` (string, required) — OpenAI-style chat message array
- `do_sample` (boolean, optional, default true)
- `stream` (boolean, optional, default false) — Stream the response as server-sent events
- `thinking` (string, optional, default "{\"type\":\"enabled\",\"clear_thinking\":false}")
- `reasoning_effort` (enum, optional, default "max", one of: low | high | max)
- `temperature` (number, optional, default 1, range 0–1)
- `top_p` (number, optional, default 0.95, range 0.01–1)
- `max_tokens` (integer, optional, range 1–131072) — Upper bound on generated tokens
- `tool_stream` (boolean, optional, default false)
- `tools` (string, optional)
- `tool_choice` (enum, optional, one of: auto)
- `stop` (string, optional)
- `response_format` (string, optional)
- `request_id` (string, optional)
- `user_id` (string, optional)

## Example request

```json
{
  "model": "glm-5.4",
  "messages": [
    {
      "role": "user",
      "content": "Design a lock-free ring buffer in Rust and explain its memory ordering."
    }
  ],
  "thinking": {
    "type": "enabled",
    "clear_thinking": false
  },
  "reasoning_effort": "low"
}
```

## Usage examples

### cURL

```bash
curl https://api.reapi.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"glm-5.4","messages":[{"role":"user","content":"Design a lock-free ring buffer in Rust and explain its memory ordering."}],"thinking":{"type":"enabled","clear_thinking":false},"reasoning_effort":"low"}'
```

### Python (OpenAI SDK)

```python
from openai import OpenAI

client = OpenAI(base_url="https://api.reapi.ai/v1", api_key="YOUR_API_KEY")
response = client.chat.completions.create(
    model="glm-5.4",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
```

### JavaScript (OpenAI SDK)

```javascript
import OpenAI from 'openai';

const client = new OpenAI({ baseURL: 'https://api.reapi.ai/v1', apiKey: 'YOUR_API_KEY' });
const response = await client.chat.completions.create({
  model: 'glm-5.4',
  messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(response.choices[0].message.content);
```

## Other agent-readable surfaces

This file covers one model. To find anything else:

- Full API reference (markdown, incl. task-type constraints and error semantics): https://reapi.ai/docs/glm-5-4.md
- Platform index: https://reapi.ai/llms.txt
- Machine-readable API spec (OpenAPI): https://api.reapi.ai/openapi.json · agent skills index: https://reapi.ai/.well-known/agent-skills/index.json
- Authentication guide: https://reapi.ai/auth.md
- Full documentation and blog as one file: https://reapi.ai/llms-full.txt
- Any other model: `https://reapi.ai/models/<slug>/llms.txt` — every model page serves this same agent-readable form.
