Instructions to use zai-org/GLM-5.2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zai-org/GLM-5.2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zai-org/GLM-5.2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("zai-org/GLM-5.2") model = AutoModelForCausalLM.from_pretrained("zai-org/GLM-5.2") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use zai-org/GLM-5.2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zai-org/GLM-5.2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zai-org/GLM-5.2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/zai-org/GLM-5.2
- SGLang
How to use zai-org/GLM-5.2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "zai-org/GLM-5.2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zai-org/GLM-5.2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "zai-org/GLM-5.2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zai-org/GLM-5.2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use zai-org/GLM-5.2 with Docker Model Runner:
docker model run hf.co/zai-org/GLM-5.2
Add ResearchClawBench evaluation result
Hi zai-org team,
We would like to add the ResearchClawBench overall evaluation result for GLM-5.2.
ResearchClawBench: https://huggingface.co/datasets/InternScience/ResearchClawBench
ResearchHarness: https://github.com/InternScience/ResearchHarness
Leaderboard: https://internscience.github.io/ResearchClawBench-Home/
ResearchClawBench is an end-to-end scientific research benchmark for evaluating AI agents and LLMs on tasks that require reading data and related work, writing code, producing figures, and generating publication-style reports.
This result was produced with ResearchHarness, using tools enabled, code execution, and a file-system workspace. The reported value is the mean score out of 100 over completed ResearchClawBench tasks.
Result details:
- Model: GLM-5.2
- Score: 20.709230769230768
- Completed tasks: 39/40
- Run date: 2026-06-22 to 2026-06-23
- Dataset task id: overall
Thank you!
Set up Pydantic Logfire observability in this project.
Target Logfire project: pathum2583/starter-project
Logfire base URL: https://logfire-us.pydantic.dev
Logfire MCP server: https://logfire-us.pydantic.dev/mcp
Docs: https://pydantic.dev/docs/logfire/get-started/
If there is no obvious application to instrument (an infra-only repo, an empty or bare repo, or you are unsure), do not guess. Ask the user what they want to send to Logfire, then follow the matching guide:
- OpenTelemetry Collector (centralize credentials, transforms, and exports): https://pydantic.dev/docs/logfire/guides/otel-collector/otel-collector-overview/
- Host metrics (CPU, memory, disk, network — no SDK required): https://pydantic.dev/docs/logfire/guides/otel-collector/host-monitoring/
- Kubernetes (cluster state, per-node metrics, pod logs): https://pydantic.dev/docs/logfire/guides/otel-collector/kubernetes-monitoring/
- Cloud provider metrics (AWS, GCP, Azure): https://pydantic.dev/docs/logfire/guides/cloud-metrics/
- AWS Lambda: https://pydantic.dev/docs/logfire/integrations/aws-lambda/
- All integrations (databases, task queues, LLM libraries, and 40+ more): https://pydantic.dev/docs/logfire/integrations/
Before editing:
- Read the repo guidance that applies: AGENTS.md, CLAUDE.md, CONTRIBUTING.md, README.md, and dev-docs/.
- Decide whether this repo is an application or a library/package.
- If it is a library or framework package with no application entry point, do not add
logfire.configure()to library code. - Instead, propose an example app, docs change, or opt-in helper and ask where it belongs.
- If it is a library or framework package with no application entry point, do not add
- If this is a monorepo or workspace, identify the app/service to instrument before changing dependencies.
- Check for
[tool.uv.workspace],pnpm-workspace.yaml, Cargo workspaces, and similar workspace files. - Do not add dependencies to the repo root unless the root is the app being instrumented.
- Check for
- Check for existing telemetry before installing anything.
- Search for
opentelemetry,telemetry,tracing,OTEL_, existing exporters, and logging setup. - Reuse the existing telemetry path instead of adding a parallel exporter.
- Search for
- Print a short plan before making changes: package manager, packages to install, files to edit, environment variables or secrets, and how you will verify data in Logfire.
Implementation guidance:
- Prefer the first-party Logfire SDK when it fits.
- Python: install
logfirewith the relevant extras, for examplelogfire[fastapi]. - JavaScript/Node: install
@pydantic/logfire-node. - Browser apps: use the browser setup docs. Never put a write token in browser code.
- Cloudflare Workers: use the Workers SDK docs and keep the write token in a Worker secret.
- Python: install
- Configure telemetry at the application startup point, before the code you want to instrument runs.
- Python local development: run
logfire authandlogfire projects use --org 'pathum2583' 'starter-project'so the SDK can use the Logfire CLI OAuth flow. - JavaScript/Node, CI, containers, deployed Python, and generic OpenTelemetry: read the write token from
LOGFIRE_TOKEN. - Do not hard-code a cloud Logfire endpoint. If the app is using self-hosted, on-prem, local, or another non-default Logfire instance, use the Logfire base URL above.
- Python on a non-default Logfire instance: authenticate with
logfire --base-url='https://logfire-us.pydantic.dev' auth, runlogfire --base-url='https://logfire-us.pydantic.dev' projects use --org 'pathum2583' 'starter-project', and configure withlogfire.configure(advanced=logfire.AdvancedOptions(base_url="https://logfire-us.pydantic.dev")). - Other SDKs and OTLP exporters: use the SDK-specific base URL or endpoint option from the Logfire docs and set it to https://logfire-us.pydantic.dev.
- Python local development: run
- If there is no first-party SDK, use the standard OpenTelemetry SDK for that language.
- Set
service.nameso records are easy to filter in Logfire. - Configure OTLP export with the endpoint from the relevant Logfire docs.
- Read the write token from the environment instead of hard-coding it.
- Set
- For OpenTelemetry Collector, Kubernetes, or platform integrations, keep the write token in the Collector or platform secret.
- Configure the Collector
otlphttpexporter to send to Logfire withAuthorization: Bearer ${LOGFIRE_TOKEN}. - Applications may send OTLP to the Collector without knowing the Logfire write token.
- Configure the Collector
- If multiple services or a frontend/backend pair are present, preserve or add W3C
traceparentpropagation across HTTP boundaries so traces can be connected.
Safety requirements:
- Do not make imports, tests, or local development fail when telemetry credentials are missing.
- Do not block test runs on browser-based auth or network calls.
- Never commit a write token. If the repo has an
.env.exampleor equivalent, documentLOGFIRE_TOKENthere. - If CI or deployment needs telemetry, name the secret that must be wired:
LOGFIRE_TOKEN. - Use safe production defaults. Do not capture extra PII. Keep existing scrubbing and sampling settings unless there is a clear reason to change them.
Verification:
- Run the repo's normal format, lint, typecheck, and tests for the files you changed.
- Run the app and trigger one representative request or job.
- Confirm data appears in the target Logfire project. If the MCP server is available, query it for the service name or span you generated. Otherwise, tell the user exactly what to search for in Live view.
- Do not treat "the code compiles" as success. Success means telemetry reaches Logfire.