glm-4.6

Text

Text-only model in the GLM-4 family with improved coding benchmarks and tool calls during reasoning, suited for software development and agent workflows.

Giá đầu vào

$0.4879Giảm 15%

Thị trường: $0.574

/ M

Giá đầu ra

$1.9499Giảm 15%

Thị trường: $2.294

/ M

Đọc cache

$0.0977Giảm 15%

Thị trường: $0.1149

/ M

Ghi cache

$0Giảm 15%

/ M

Đầu vào

Văn bản

Đầu ra

Văn bản

API

Bắt đầu nhanh

Mã sẵn sàng để gọi mô hình này qua API tương thích OpenAI của EasyAPI.

1

Lấy API key

Tạo API token trong console và đặt làm biến môi trường:

Thay sk-xxxxxxxx bằng mã API từ console (Bearer Token).

Tạo API token
shell
export EASYAPI_API_KEY=sk-xxxxxxxx
2

Gửi yêu cầu đầu tiên

Dùng zai/glm-4.6 với API EasyAPI:

cURL
curl https://token.easyapi.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $EASYAPI_API_KEY" \
  -d '{
  "model": "zai/glm-4.6",
  "messages": [
    {
      "role": "user",
      "content": "Hello!"
    }
  ]
}'
3

Bật streaming

Thêm "stream": true vào body để nhận phản hồi qua SSE:

curl
curl -N https://token.easyapi.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $EASYAPI_API_KEY" \
  -d '{"model":"zai/glm-4.6","messages":[{"role":"user","content":"Hello!"}],"stream":true}'

Endpoint

Gửi yêu cầu chat completion. Hỗ trợ streaming và non-streaming.

POSThttps://token.easyapi.com/v1/chat/completions
Authorization
Bearer $EASYAPI_API_KEY
Content-Type
application/json
Model
zai/glm-4.6

Gửi yêu cầu chat completion, hỗ trợ cả phản hồi streaming và không streaming. Tài liệu

GEThttps://token.easyapi.com/v1/models
Authorization
Bearer $EASYAPI_API_KEY

Lấy danh sách mô hình khả dụng cho tài khoản hiện tại. Tài liệu

Tham số

TênKiểuMặc địnhMô tả
modelstringID mô hình, ví dụ openai/gpt-4o hoặc anthropic/claude-3-5-sonnet
messagesarrayDanh sách tin nhắn hội thoại, mỗi mục gồm role và content
streambooleanfalseKhi đặt true, phản hồi được stream qua SSE
temperaturefloat1Nhiệt độ lấy mẫu; càng cao càng ngẫu nhiên
max_tokensintegerSố token tối đa được tạo trong một phản hồi
top_pfloat1Nucleus sampling; giới hạn xác suất tích lũy của các token ứng viên
frequency_penaltyfloat0Phạt tần suất; giảm lặp từ
presence_penaltyfloat0Phạt hiện diện; khuyến khích chủ đề mới

Dùng SDK bên thứ ba

SDK chính thức OpenAI và khác hoạt động khi đổi base URL. Xem hướng dẫn tích hợp