GPT Image 2.5 is live — OpenAI's newest image model, targeted edits that leave the rest of the frame alone

Text

glm-5-3

Use GLM 5.3 on reAPI via OpenAI Chat Completions or Anthropic Messages. Official parameters, 1M context, 128K output cap, streaming tools, and dated checks.

GLM 5.3 runs on POST https://api.reapi.ai/v1/chat/completions (OpenAI Chat Completions, primary) and POST https://api.reapi.ai/v1/messages (Anthropic Messages, for Anthropic SDKs and Claude Code) under the exact wire ID glm-5.3. Calls return a synchronous JSON payload or an SSE stream rather than an asynchronous task ID. Current pricing and playground.

The request surface follows Z.AI's OpenAPI 3.0.1 Chat Completion schema for glm-5.3. Extra fields pass through untouched; upstream decides whether to apply, ignore, or reject them. The dated probe log below separates verified runtime behavior from vendor documentation.

Quickstart

Create a key in API keys and keep it on your server. The examples below disable SDK auto-retries so client retry policy stays explicit.

curl https://api.reapi.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.3",
    "messages": [{"role": "user", "content": "Review a proposed checkout retry policy and identify duplicate-charge risks."}],
    "thinking": {"type": "enabled", "clear_thinking": false},
    "reasoning_effort": "low",
    "stream": true
  }'
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.reapi.ai/v1",
    max_retries=0,
)
response = client.chat.completions.create(
    model="glm-5.3",
    messages=[
        {
            "role": "user",
            "content": "Review a proposed checkout retry policy and identify duplicate-charge risks.",
        }
    ],
    extra_body={
        "thinking": {"type": "enabled", "clear_thinking": false},
        "reasoning_effort": "low",
    },
)
print(response.choices[0].message.content)
assistant_message = response.choices[0].message.model_dump(exclude_none=True)
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'YOUR_API_KEY',
  baseURL: 'https://api.reapi.ai/v1',
  maxRetries: 0,
});
const response = await client.chat.completions.create({
  model: 'glm-5.3',
  messages: [
    {
      role: 'user',
      content: 'Review a proposed checkout retry policy and identify duplicate-charge risks.',
    },
  ],
  thinking: { type: 'enabled', clear_thinking: false },
  reasoning_effort: 'low',
});
console.log(response.choices[0].message.content);
const assistantMessage = response.choices[0].message;
package main

import (
    "bytes"
    "io"
    "net/http"
    "os"
    "time"
)

func main() {
    body := []byte(`{"model":"glm-5.3","messages":[{"role":"user","content":"Review a proposed checkout retry policy and identify duplicate-charge risks."}],"thinking":{"type":"enabled","clear_thinking":false},"reasoning_effort":"low"}`)
    req, err := http.NewRequest("POST", "https://api.reapi.ai/v1/chat/completions", bytes.NewReader(body))
    if err != nil { panic(err) }
    req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
    req.Header.Set("Content-Type", "application/json")
    client := &http.Client{Timeout: 120 * time.Second,
        CheckRedirect: func(req *http.Request, via []*http.Request) error { return http.ErrUseLastResponse }}
    res, err := client.Do(req)
    if err != nil { panic(err) }
    defer res.Body.Close()
    if _, err := io.Copy(os.Stdout, res.Body); err != nil { panic(err) }
    if res.StatusCode >= 400 { os.Exit(1) }
}

Endpoint

POST https://api.reapi.ai/v1/chat/completions

Send Authorization: Bearer YOUR_API_KEY and Content-Type: application/json. Responses use application/json, or text/event-stream when stream: true. Use the lowercase wire model ID glm-5.3 (not the URL slug glm-5-3). There is no task-polling endpoint.

Official input parameters

The table below lists the 16 top-level parameters in Z.AI's Chat Completion schema for glm-5.3, along with limits confirmed against the active gateway on December 5, 2026.

ParameterTypeRequired / defaultMeaning
modelstringRequiredModel ID: glm-5.3 (or glm-5.3:<group> for explicit group routing).
messagesarrayRequiredText-only conversation turns (system, user, assistant, tool). Multimodal image_url payloads return HTTP 400.
do_samplebooleantrueSampling toggle. Set false for greedy decoding (temperature and top_p do not apply).
streambooleanfalseSet true for SSE streaming ending with data: [DONE]. Recommended for long reasoning turns.
thinkingobject{"type":"enabled","clear_thinking":false}Chain-of-thought settings. Z.AI documents GLM-5.3 as always-on reasoning; clear_thinking: false keeps reasoning intact across multi-turn tool calls.
reasoning_effortstring"max"Z.AI documents "low", "high", and "max" (upstream default "max"). Set "low" for fast, bounded turns.
temperaturenumber1.0Sampling randomness in [0.0, 1.0]. Tune either temperature or top_p, not both together.
top_pnumber0.95Nucleus sampling in [0.01, 1.0]. Tune either temperature or top_p, not both together.
max_tokensintegerOmittedMaximum generated tokens (reasoning plus visible output). Active channel enforces 1–128000 (128001 returns HTTP 400).
tool_streambooleanfalseStreams function-call argument deltas incrementally when paired with stream: true.
toolsarrayOmittedUp to 128 function tool definitions (type: "function"). Multi-turn tool loops are live-verified.
tool_choicestring"auto"Tool selection mode when tools is passed.
stopstring[]OmittedStop strings (up to 4 items). Verified truncating output cleanly on match.
response_formatobject{"type":"text"}Output format: {"type":"text"}, {"type":"json_object"}, or {"type":"json_schema", ...}.
request_idstringOmittedOptional caller-supplied unique ID (6–64 characters).
user_idstringOmittedOptional end-user identifier (6–128 characters). Avoid PII.

Standard OpenAI Chat Completions options (max_completion_tokens, n, seed, logprobs, top_logprobs, frequency_penalty, presence_penalty) also pass through and were verified returning HTTP 200 on the active channel.

Output cap and modality boundaries

  • Active channel cap (128,000 tokens): In December 5, 2026 live checks, max_tokens: 128000 returned HTTP 200 while 128001 (and 131072) returned HTTP 400 (max_tokens_exceeded). Both max_tokens: 30 and max_completion_tokens: 30 strictly stopped generation at 30 tokens (finish_reason: "length").
  • Text-only input: Sending image_url blocks returns HTTP 400. For screenshot, video, or document understanding, use GLM 5.4.
  • Context window: 1,048,576 tokens (1M) documented by Z.AI across input, reasoning history, tool payloads, and output. No full 1M-token stress test was run during integration checks.

Multi-turn function calling and streaming tools

Pass tools and keep stream: true with tool_stream: true when building interactive coding agents. Execute tools in your application, append each role: "tool" result with its matching tool_call_id, and echo the returned assistant message unchanged:

tools = [{
    "type": "function",
    "function": {
        "name": "get_deploy_status",
        "description": "Return the latest deployment status for a service.",
        "parameters": {
            "type": "object",
            "properties": {"service": {"type": "string"}},
            "required": ["service"],
        },
    },
}]

stream = client.chat.completions.create(
    model="glm-5.3",
    messages=[{"role": "user", "content": "Check deployment status for checkout-api."}],
    tools=tools,
    tool_choice="auto",
    stream=True,
    extra_body={
        "thinking": {"type": "enabled", "clear_thinking": False},
        "reasoning_effort": "low",
        "tool_stream": True,
    },
)

reasoning, content, calls = "", "", {}
for chunk in stream:
    if not chunk.choices:
        continue
    delta = chunk.choices[0].delta
    thought = getattr(delta, "reasoning_content", None) or getattr(delta, "reasoning", None)
    if thought:
        reasoning += thought
    if delta.content:
        content += delta.content
    for tc in delta.tool_calls or []:
        slot = calls.setdefault(tc.index, {"id": "", "name": "", "arguments": ""})
        if tc.id:
            slot["id"] = tc.id
        if tc.function and tc.function.name:
            slot["name"] = tc.function.name
        if tc.function and tc.function.arguments:
            slot["arguments"] += tc.function.arguments

Streaming

Set stream: true for SSE output. Read reasoning tokens from delta.reasoning_content or delta.reasoning, visible output from delta.content, and tool deltas from delta.tool_calls. reAPI requests stream_options.include_usage: true upstream so final token counts arrive before data: [DONE]. Treat any connection drop before [DONE] as incomplete.

Capability observations — December 5, 2026

These live probes checked integration behavior through the active gateway; they are not an independent quality benchmark.

CapabilityObservation
Non-stream text & billing receiptHTTP 200; returned answer, usage, and exact per-request billing receipt.
Streaming SSEHTTP 200 text/event-stream; streamed chunks, emitted trailing usage, and closed with data: [DONE].
reasoning_effort levelslow, high, and max all returned HTTP 200. Other effort strings also returned HTTP 200 on the active channel, though Z.AI documents low / high / max.
thinking options{"type":"enabled","clear_thinking":false} and clear_thinking: true returned HTTP 200. Sending {"type":"disabled"} returned HTTP 200 on the current channel yet still produced reasoning tokens.
Output capsmax_tokens: 30 and max_completion_tokens: 30 both capped strictly at 30 completion tokens (finish_reason: "length"). 128000 returned HTTP 200; 128001 returned HTTP 400 (max_tokens_exceeded).
Sampling, stop, seed, logprobs, penaltiesdo_sample: false, temperature: 0.2, top_p: 0.8, seed: 42, frequency_penalty, and presence_penalty returned HTTP 200. stop: ["3"] truncated cleanly at "1 2 ". logprobs: true returned token log probabilities.
Multiple choices (n: 2)HTTP 200 with 2 choices returned (choices.length === 2).
Structured outputBoth response_format: {"type":"json_object"} and json_schema returned valid JSON. Keep application-side schema validation.
Function tools & tool_streamTwo-turn function loop succeeded (finish_reason: "tool_calls" → final answer); stream: true + tool_stream: true streamed incremental argument chunks.
Public image_urlReturned HTTP 400 confirming text-only input.
Anthropic Messages (/v1/messages)Non-stream JSON (thinking + text blocks), SSE streaming (message_start → content_block_delta → message_stop), and tools (input_schema → tool_use) all returned HTTP 200 with exact billing receipts.

Anthropic Messages compatibility

If your client runs on an Anthropic SDK or Claude Code, call POST https://api.reapi.ai/v1/messages with x-api-key and anthropic-version: 2023-06-01:

curl https://api.reapi.ai/v1/messages \
  -H "x-api-key: YOUR_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.3",
    "max_tokens": 4096,
    "messages": [{"role": "user", "content": "Review this retry policy for idempotency bugs."}]
  }'

Use /v1/chat/completions when you need Z.AI-specific fields such as thinking.clear_thinking, tool_stream, or do_sample.

Groups

Check live group prices on the GLM 5.3 page. One reAPI key works across all available groups.

The bare glm-5.3 ID routes to the default glm group. If additional groups appear in the price table, select one explicitly with glm-5.3:<group> as described in LLM groups.

Pricing and billing

Input tokens, output tokens (including thinking tokens), and cached input token reads are metered separately. See current rates on the GLM 5.3 page; no numeric SKU prices are hardcoded here.

Settlement uses integer micro-USD: microUSD = ceil(settled_USD_charge × 1,000,000) and credits = microUSD / 1,000, where 1 credit = $0.001.

reAPI forwards exactly one upstream request per accepted API call with no automatic retries and no server-side tool execution. Postpaid settlement requires valid delivery and usage evidence; upstream errors or interrupted streams settle with no charge.

Output schema

A non-streaming response uses the Chat Completions envelope (illustrative token counts):

{
  "id": "chatcmpl-req_0195f0d4b7a270008000123456789abc",
  "object": "chat.completion",
  "created": 1796445435,
  "model": "glm-5.3",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Retrying on 5xx without an idempotency key can trigger duplicate charges...",
        "reasoning": "Check payment state transitions before recommending retry bounds..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 96,
    "completion_tokens": 74,
    "total_tokens": 170,
    "prompt_tokens_details": {
      "cached_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 22
    }
  }
}

Errors

reAPI errors return error.code, error.message, error.request_id, and Chat-compatible error.type:

HTTP / codeMeaning
401 / 10001–10005Missing, invalid, or revoked API key.
400 / 20001, 20002, 20003, 20004Invalid JSON, missing fields, invalid parameter value (e.g. max_tokens > 128000 or multimodal image parts), or unknown model ID.
413 / 20008Request payload exceeds limit.
402 / 30001Insufficient balance.
429 / 50001Rate or in-flight concurrency limit reached.
502–503 / 70001Upstream inference or pricing service unavailable.

See the full error-code catalog.

Tips

  • Start with reasoning_effort: "low" and stream: true for routine reviews and tool loops; step up to "high" or "max" only when harder debugging justifies extra thinking tokens.
  • Keep max_tokens at or below 128000, and remember that thinking tokens share that budget with the visible answer.
  • If your parser reads chain-of-thought traces on Chat Completions, check both reasoning_content and reasoning so it handles every gateway response shape cleanly.

Compare the GLM 5.4 documentation (adds multimodal image/video/file inputs and Loop Transformer depth) and GLM 5.2 documentation, or visit the GLM 5.3 model page for live pricing and playground testing.

Official references