推理提供商文档
Z.ai
加入 Hugging Face 社区
并获得增强的文档体验
开始使用
Z.ai
您可以通过 此处 找到所有支持的 Z.ai 模型
Z.ai 是一个 AI 平台,提供由 GLM 系列驱动的尖端大型语言模型。其旗舰模型具有混合专家(MoE)架构,并具备高级推理、编码和代理能力。
有关最新定价,请访问 定价页面。
资源
- 网站: https://z.ai/
- 文档: https://docs.z.ai/
- API 文档: https://docs.z.ai/api-reference/introduction
- GitHub: https://github.com/zai-org
- Hugging Face: https://huggingface.co/zai-org
支持的任务
聊天补全 (LLM)
了解更多关于聊天补全 (LLM) 的信息,请点击这里。
语言
客户端
提供商
import os
from openai import OpenAI
client = OpenAI(
base_url="https://router.huggingface.co/v1",
api_key=os.environ["HF_TOKEN"],
)
completion = client.chat.completions.create(
model="zai-org/GLM-4.7-Flash:zai-org",
messages=[
{
"role": "user",
"content": "What is the capital of France?"
}
],
)
print(completion.choices[0].message)聊天补全 (VLM)
了解更多关于聊天补全 (VLM) 的信息,请点击这里。
语言
客户端
提供商
import os
from openai import OpenAI
client = OpenAI(
base_url="https://router.huggingface.co/v1",
api_key=os.environ["HF_TOKEN"],
)
completion = client.chat.completions.create(
model="zai-org/GLM-4.6V:zai-org",
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this image in one sentence."
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
}
}
]
}
],
)
print(completion.choices[0].message)文本到图像
详细了解文本到图像 此处。
语言
提供商
import os
from huggingface_hub import InferenceClient
client = InferenceClient(
provider="zai-org",
api_key=os.environ["HF_TOKEN"],
)
# output is a PIL.Image object
image = client.text_to_image(
"Astronaut riding a horse",
model="zai-org/GLM-Image",
)
