一、前提
- 会魔法上网
- 本地运行代理软件,知道端口号(如1081)。
127.0.0.1:1081
二、通过curl调通openai的api
curl https://api.openai.com/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer $OPENAI_API_KEY" -d '{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "system",
"content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."
},
{
"role": "user",
"content": "Compose a poem that explains the concept of recursion in programming."
}
]
}'
curl -x socks5://127.0.0.1:1081 https://api.openai.com/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer xxx" -d '{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "system",
"content": "You are a poetic as