-
注册,登陆,
Start building
,取一个子域名,Create a Worker
。 -
复制 cf_worker.js 到左侧代码框,
Save and deploy
。
- 对话
curl --location 'https://openai.1rmb.tk/v1/chat/completions' \
--header 'Authorization: Bearer sk-xxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-3.5-turbo",
"messages": [{"role": "user", "content": "Hello!"}]
}'
响应
{
"id": "chatcmpl-6rMlZybwjMQIhFAEaiCmWvMP1BXld",
"object": "chat.completion",
"created": 1678176917,
"model": "gpt-3.5-turbo-0301",
"usage": {
"prompt_tokens": 9,
"completion_tokens": 11,
"total_tokens": 20
},
"choices": [
{
"message": {
"role": "assistant",
"content": "\n\nHello! How can I assist you today?"
},
"finish_reason": "stop",
"index": 0
}
]
}
- 查询key余额
curl --location 'https://openai.1rmb.tk/dashboard/billing/credit_grants' \
--header 'Authorization: Bearer sk-xxxxxx'
响应
{
"object": "credit_summary",
"total_granted": 18.0,
"total_used": 9.543368000000001,
"total_available": 8.456631999999999,
"grants": {
"object": "list",
"data": [
{
"object": "credit_grant",
"id": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"grant_amount": 18.0,
"used_amount": 18,
"effective_at": 1666666200.0,
"expires_at": 1666666600.0
}
]
}
}