THUDM / ChatGLM2-6B

ChatGLM2-6B: An Open Bilingual Chat LLM | 开源双语对话语言模型
Other
15.65k stars 1.85k forks source link

[BUG/Help] <title>如何通过API来调用ChatGLM? #657

Open 20130216 opened 6 months ago

20130216 commented 6 months ago

Is there an existing issue for this?

Current Behavior

"model": "GLM-4.0" or "GLM-3-Turbo" "base_url": "https://open.bigmodel.cn/api/paas/v4/chat/completions", "api_key": "****", "api_type": "SSE" or "json" or "open_ai"(选哪个?)

在调用glm的API时,按以上参数配置,在"api_key"准确的前提下,老是提醒:AuthenticationError: Error code: 401 - {'error': {'code': '401', 'message': '令牌已过期或验证不正确!'}}

Expected Behavior

No response

Steps To Reproduce

1.请问以上配置,有关"api_type":是不是应该指定是"open_ai"? 2.为何老师报错?("api_key"刚申请的,不会填错)

Environment

- OS:
- Python:
- Transformers:
- PyTorch:
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) :

Anything else?

No response