💸低成本接入各大品牌系列模型
官方 API 价格过高?无法使用国内支付方式?这里帮你轻松实现你的需求
无需修改代码逻辑 只需将OpenAI的API地址替换为我们的API地址即可
https://ai.sparku.net
import requests
import json
url = "https://ai.sparku.net/v1/chat/completions"
payload = json.dumps({
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "请介绍一下你自己"
}
],
"temperature": 0.7
})
headers = {
'Authorization': 'Bearer sk-please-replace-with-your-key',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)