-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patht1.sh
More file actions
executable file
·43 lines (38 loc) · 1.47 KB
/
Copy patht1.sh
File metadata and controls
executable file
·43 lines (38 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# =============================================================================
# t1.sh - 调用智谱 GLM 的 OpenAI 端口 & Anthropic 端口
# =============================================================================
API_KEY="21398826077248468e60a361c58d0617.UFuBE2Xd2GEgXqI2"
echo "================================"
echo " 1. OpenAI 端口 - /v1/chat/completions"
echo " POST https://open.bigmodel.cn/api/paas/v4/chat/completions"
echo "================================"
curl -s -w "\nHTTP_STATUS: %{http_code}\n" https://open.bigmodel.cn/api/paas/v4/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.1",
"messages": [
{"role": "system", "content": "你是一个助手"},
{"role": "user", "content": "用一句话介绍自己"}
],
"temperature": 0.7,
"max_tokens": 200
}' | jq .
echo
echo "================================"
echo " 2. Anthropic 端口 - /v1/messages"
echo " POST https://open.bigmodel.cn/api/anthropic/v1/messages"
echo "================================"
curl -s -w "\nHTTP_STATUS: %{http_code}\n" https://open.bigmodel.cn/api/anthropic/v1/messages \
-H "x-api-key: $API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.1",
"max_tokens": 200,
"system": "你是一个助手",
"messages": [
{"role": "user", "content": "用一句话介绍自己"}
]
}' | jq .