curl https://0809.fuhuagoogle.top/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "glm-5.1",
"messages": [
{
"role": "system",
"content": "你是一个简洁准确的开发助手。"
},
{
"role": "user",
"content": "请用三句话介绍统一模型网关在项目接入中的作用。"
}
],
"stream": true
}'
from openai import OpenAI
# 示例请求:请将 YOUR_API_KEY 替换为对应模型分组的密钥
# model 可替换为该分组下当前可用的模型名称
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://0809.fuhuagoogle.top/v1",
)
stream = client.chat.completions.create(
model="glm-5.1",
messages=[
{"role": "system", "content": "你是一个简洁准确的开发助手。"},
{"role": "user", "content": "请用三句话介绍统一模型网关在项目接入中的作用。"},
],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
// Node.js 18+ 示例请求:请将 YOUR_API_KEY 替换为对应分组的密钥
const response = await fetch("https://0809.fuhuagoogle.top/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
},
body: JSON.stringify({
model: "glm-5.1",
messages: [
{ role: "system", content: "你是一个简洁准确的开发助手。" },
{ role: "user", content: "请用三句话介绍统一模型网关在项目接入中的作用。" }
],
stream: true
})
});
if (!response.ok || !response.body) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
const reader = response.body.getReader();
const decoder = new TextDecoder("utf-8");
while (true) {
const { done, value } = await reader.read();
if (done) break;
process.stdout.write(decoder.decode(value, { stream: true }));
}