代理地址(任选其一): - https://noc.cy - https://noc.cy/v1 - https://noc.cy/v1/chat/completions
import requests
url = "https://noc.cy/v1/chat/completions"
headers = {"Authorization": "Bearer YOUR_KEY"}
payload = {
"model": "gpt-4o",
"messages": [{"role": "user", "content": "你好"}]
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
# CURL 示例
curl -X POST "https://noc.cy/v1/chat/completions" \
-H "Authorization": "Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "你是谁"}],
"stream": true,
"temperature": 0.5
}'
以下是curl调用的body内容示例:
{
"model": "gpt-4o",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"stream": false,
"role": "user",
"content": "你是谁",
"temperature": 0.5,
"presence_penalty": 2
}
]
}