export ZAI_API_KEY=your-api-key
参数 | 类型 | 默认值 | 说明 |
---|---|---|---|
model | string | 必填 | 要使用的模型名称 |
messages | array | 必填 | 对话消息列表 |
temperature | float | 0.95 | 控制输出的随机性 (0-1) |
top_p | float | 0.7 | 核采样参数 (0-1) |
max_tokens | integer | - | 最大输出token数 |
stream | boolean | false | 是否使用流式输出 |
stop | string/array | - | 停止生成的标记 |
OpenAI 模型 | 智谱AI 对应模型 | 说明 |
---|---|---|
gpt-4 | glm-4-plus | 最强性能模型 |
gpt-4-turbo | glm-4-air-250414 | 平衡性能和成本 |
gpt-3.5-turbo | glm-4-flash | 快速响应模型 |
gpt-4-vision | glm-4v-plus | 视觉理解模型 |