Spaces:
Sleeping
http://localhost:7860/v1/https/open.bigmodel.cn/api/paas/v4/chat/completions { "model": "glm-4-flash", "messages": [ {"role": "system", "content": "你是一个有用的助手"}, {"role": "user", "content": "你好!请介绍一下自己。"} ], "stream": true }
http://127.0.0.1:7860/v1/https/generativelanguage.googleapis.com/v1beta/openai/chat/completions { "model":"gemini-2.5-flash-preview-05-20", "messages":[ {"role": "system", "content": "你是一个有用的助手"}, {"role": "user", "content": "你好!请介绍一下自己。"} ], "stream": true }
curl -v --location 'http://127.0.0.1:7860/v1/https/generativelanguage.googleapis.com/v1beta/openai/chat/completions'
--header 'Authorization: Bearer xxx'
--header 'accept-encoding: identity'
--header 'User-Agent: PostmanRuntime/7.45.0'
--header 'Content-Type: application/json'
--data '{
"model":"gemini-2.5-flash-preview-05-20",
"messages":[
{"role": "system", "content": "你是一个有用的助手"},
{"role": "user", "content": "你好!请介绍一下自己。"}
],
"stream": false
}'
转发程序为:@/proxyserver.py
假设数据为: { "model":"gemini-2.5-flash-preview-05-20", "messages":[ {"role": "system", "content": "你是一个有用的助手"}, {"role": "user", "content": "你好!请介绍一下自己。"} ], "stream": false }
使用postman发送时没有问题
使用curl 发送时,出现问题,数据无法返回,proxyserver 的log 为:
代理请求到 https://generativelanguage.googleapis.com/v1beta/openai/chat/completions
/home/tanbushi/miniconda3/envs/any-api/lib/python3.11/site-packages/urllib3/connectionpool.py:1097: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings
warnings.warn(
目标API响应状态码: 200
目标API响应体: {"choices":[{"finish_reason":"stop","index":0,"message":{"content":"你好!很高兴能与你交流。\n\n我是一个由 Google 训练的**大型语言模型**。我的主要目标是协助你,提供信息,并进行各种基于语言的任务。\n\n我可以做很多事情,比如:\n* **回答你的问题**:只要是我的知识范围内,我会尽力给你准确、有用的答案。\n* **撰写不同类型的内容**:无论是文章、邮件、诗歌、故事、代码,还是仅仅是帮你整理思绪,我都可以尝试。\n* **进行翻译**:在不同的语言之间进行文本转换。\n* **提供创意灵感**:当你需要一些新的想法或突破思维定势时,我可以提供帮助。\n* **总结信息**:将长篇内容提炼成简明扼要的要点。\n* **学习新知识**:帮助你理解复杂的概念或探索新的领域。\n* **进行对话**:与你进行自然的交流,解答你的疑惑或只是聊聊天。\n\n我没有身体,也没有个人情感、意识或观点。我的存在是为了处理和生成文本,并以最有用的方式为你服务。\n\n如果你有任何问题或需要...
127.0.0.1 - - [03/Aug/2025 12:01:11] "POST /v1/https/generativelanguage.googleapis.com/v1beta/openai/chat/completions HTTP/1.1" 200 -