Skip to content

Commit 3a25a44

Browse files
author
zhengweijun
committed
readme
1 parent 951b1eb commit 3a25a44

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ pip install zai-sdk
7777
## 🚀 Quick Start
7878

7979
### Create API Key
80+
81+
#### Get API Key
82+
- **Overseas regions**: Visit [Z.ai Open Platform](https://docs.z.ai/) to get your API key
83+
- **Mainland China regions**: Visit [Zhipu AI Open Platform](https://www.bigmodel.cn/) to get your API key
84+
85+
#### API BASE URL
86+
- **Mainland China regions**: `https://open.bigmodel.cn/api/paas/v4/`
87+
- **Overseas regions**: `https://api.z.ai/api/paas/v4/`
88+
89+
#### Usage Steps
8090
1. **Create client with API key**
8191
2. **Call the corresponding API methods**
8292

@@ -85,11 +95,14 @@ For complete examples, please refer to the open platform [API Reference](https:/
8595
### Basic Usage
8696

8797
```python
88-
from zai import ZaiClient
98+
from zai import ZaiClient, ZhipuAiClient
8999

90-
# Initialize client
100+
# For Overseas users, create the ZaiClient
91101
client = ZaiClient(api_key="your-api-key")
92102

103+
# For Chinese users, create the ZhipuAiClient
104+
client = ZhipuAiClient(api_key="your-api-key")
105+
93106
# Create chat completion
94107
response = client.chat.completions.create(
95108
model="glm-4",

README_CN.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,45 @@ pip install zai-sdk
7676

7777
## 🚀 快速开始
7878

79-
### 基本用法
79+
### 创建 API Key
80+
81+
#### 获取 API Key
82+
- **海外区域**: 访问 [Z.ai 开放平台](https://docs.z.ai/) 获取 API Key
83+
- **中国大陆区域**: 访问 [智谱 AI 开放平台](https://www.bigmodel.cn/) 获取 API Key
84+
85+
#### API BASE URL
86+
- **中国大陆区域**: `https://open.bigmodel.cn/api/paas/v4/`
87+
- **海外区域**: `https://api.z.ai/api/paas/v4/`
88+
89+
#### 使用步骤
8090

8191
1. **使用API密钥创建客户端**
8292
2. **调用相应的API方法**
8393

8494
完整示例请参考开放平台[接口文档](https://docs.z.ai/api-reference/)以及[使用指南](https://docs.z.ai/guides/),记得替换为您自己的API密钥。
8595

96+
### 基本用法
97+
### Basic Usage
98+
99+
```python
100+
from zai import ZaiClient, ZhipuAiClient
101+
102+
# 对于海外用户,使用ZaiClient
103+
client = ZaiClient(api_key="your-api-key")
104+
105+
# 对于中国大陆用户,使用ZhipuAiClient
106+
client = ZhipuAiClient(api_key="your-api-key")
107+
108+
# Create chat completion
109+
response = client.chat.completions.create(
110+
model="glm-4",
111+
messages=[
112+
{"role": "user", "content": "Hello, Z.ai!"}
113+
]
114+
)
115+
print(response.choices[0].message.content)
116+
```
117+
86118
### 客户端配置
87119

88120
SDK支持多种方式配置API密钥:

0 commit comments

Comments
 (0)