您现在的位置是:首页 >学无止境 >chatGPT推荐2个key免费使用网站首页学无止境
chatGPT推荐2个key免费使用
简介chatGPT推荐2个key免费使用
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
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
同时推荐一下一个国内比较稳定的代理
#查询余额
curl https://api.openai-proxy.com/pro/balance?apiKey=sk-XXX | jq
Python代码也可以查询
import requests
import json
def get_balance(api_key):
url = "https://api.openai-proxy.com/pro/balance"
params = {'apiKey': api_key}
response = requests.get(url, params=params)
json_data = json.loads(response.text)
if 'data' in json_data:
data = json_data['data']
return {"total": data['total'], "balance": data['balance'], "used": data['used']}
else:
return None
api_key = input("请输入 OpenAI API 密钥:")
balance = get_balance(api_key)
if balance is not None:
print("当前账户: 总共=${}, 剩余=${:.2f}, 已使用=${}".format(balance['total'], balance['balance'], balance['used']))
else:
print("发生错误:无法获取账户余额")
docker部署
docker run -d
--name chatgpt-web
-p :3002:3002
-e OPENAI_API_KEY=sk-xxxx
-e OPENAI_API_BASE_URL=https://api.openai-proxy.com
images:xxx
k8s部署
apiVersion: v1
kind: ConfigMap
metadata:
name: chatgpt-config
data:
OPENAI_API_KEY: "sk-xxxx"
OPENAI_API_BASE_URL: "https://api.openai-proxy.com"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: chatgpt-deployment
spec:
selector:
matchLabels:
app: chatgpt
replicas: 1
template:
metadata:
labels:
app: chatgpt
spec:
containers:
- name: chatgpt
image: xxxx
imagePullPolicy: Never
ports:
- containerPort: 3002
envFrom:
- configMapRef:
name: chatgpt-config
volumeMounts: # 挂载 SSL 证书
- name: tls-certs
mountPath: /etc/ssl/certs/ca-certificates.crt
readOnly: true
volumes:
- name: tls-certs
configMap:
name: tls-certs
---
apiVersion: v1
kind: Service
metadata:
name: chatgpt-service
spec:
selector:
app: chatgpt
ports:
- name: web
port: 3002
targetPort: 3002
nodePort: 3002
type: NodePort
不在需要翻墙本地访问就可以了
风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。