MODEL ACCESS / GLM-5

Connect GLM-5 with an OpenAI-compatible request.

Use the glm-5 alias for text chat through BestLLM. This guide documents the implemented non-streaming Edge contract and GLM-5 family route configuration, not a guarantee that a live route is enabled for your account.

Before your first call

  1. Sign in to the Console and select a workspace.
  2. Verify your account email, then check that Models lists an approved glm-5 route for your workspace.
  3. Confirm a US-scoped key and available wallet balance under API keys and Billing.
  4. Store your key in a server-side environment variable named BESTLLM_API_KEY. Never embed it in browser code or public issues.

If access is missing or dispatch is disabled, ask your workspace administrator. Changing the model string does not bypass route approval (403 model_route_not_approved) or operator dispatch gating (402 wallet_authorization_required).

GLM-5 family scope & version boundaries

glm-5 is listed in the public catalog and gateway route configuration. The current gateway route config also defines GLM-5 family entries for glm-5-1, glm-5-2, glm-5-3, and glm-5-3-flash. A config entry is not a promise that every alias is approved or enabled for your workspace — confirm your approved model versions directly in the Console.

No GLM-5.4 claim: BestLLM has not launched a glm-5.4 route, and this guide publishes no GLM-5.4 benchmarks or third-party Artificial Analysis scores. To compare upstream GLM model generations and specifications, review the official Z.ai documentation and verify your workspace’s active mapping in Console.

Edge limits & price check

Current Edge scope: text chat via POST /v1/chat/completions, stream: false, and US-scoped keys only. Streaming requests return 501 streaming_not_implemented; non-US keys return 403 region_not_served. Tool calling, structured outputs, reasoning parameter tuning, and multimodal inputs are not validated by these examples.

Reviewed November 27, 2026. The GLM-5 catalog entry cites a September 29, 2026 supplier snapshot (USD/CNY 6.72) for historical reference only — it is not a verified live quote. Confirm the effective workspace price in Console before sending billable traffic; the gateway snapshots its database price on acceptance and records charges in Usage and Billing.

Send one small non-streaming curl request

Export BESTLLM_API_KEY in your shell environment first. This example targets the documented public endpoint; a successful live provider call has not been verified for this guide. For a configured local gateway, replace the URL with http://127.0.0.1:4000/v1/chat/completions.

curl --silent --show-error --fail-with-body --max-time 70 \
  https://api.bestllm.dev/v1/chat/completions \
  -H "Authorization: Bearer ${BESTLLM_API_KEY:?Set BESTLLM_API_KEY securely first}" \
  -H "Content-Type: application/json" \
  --data '{
  "model": "glm-5",
  "messages": [
    {
      "role": "user",
      "content": "Explain the difference between TCP and UDP in two sentences."
    }
  ],
  "max_tokens": 128,
  "stream": false
}'

On HTTP 200, inspect choices[0].message.content and usage. The returned upstream model identifier may differ from the glm-5 alias. No sample output or latency number is presented as a measured live result.

Non-streaming Python OpenAI SDK example

Install the official client with python -m pip install openai, keep max_retries=0 while validating access and billing, and set stream=False. For a configured local gateway, use base_url="http://127.0.0.1:4000/v1".

import os
from openai import OpenAI, APIStatusError, APIConnectionError

client = OpenAI(
    api_key=os.environ["BESTLLM_API_KEY"],
    base_url="https://api.bestllm.dev/v1",
    max_retries=0,
    timeout=70.0,
)

try:
    response = client.chat.completions.create(
        model="glm-5",
        messages=[{"role": "user", "content": "Explain the difference between TCP and UDP in two sentences."}],
        max_tokens=128,
        stream=False,
    )
    print(response.choices[0].message.content)
    print(response.usage)
except APIStatusError as exc:
    # Gateway errors use {"error": "code"}; inspect the HTTP body directly.
    print("HTTP", exc.status_code)
    print(exc.response.text)
except APIConnectionError:
    print("Connection or timeout error. Check usage before retrying.")

A connection timeout or 503 settlement response does not prove the upstream provider did no work — check Console Usage and Billing before resending. Gateway errors use flat {"error": "code"} JSON bodies, so inspect exc.response.text directly.

Troubleshoot & next steps

Review every error code emitted by the current Edge service — including auth, region, route approval, rate limits, and settlement reconciliation — before scaling traffic.

OpenAI-compatible client error checklist →

GLM-5 catalog overview & specs →

DeepSeek Chat API setup →

Official Z.ai GLM documentation →

Back to API documentation