赞
踩
from openai import OpenAI
client = OpenAI(
base_url=“https://api.gpts.vin/v1”,
api_key=“sk-xxx”
)
completion = client.chat.completions.create(
model=“gpt-3.5-turbo”,
messages=[
{“role”: “system”, “content”: “You are a helpful assistant.”},
{“role”: “user”, “content”: “Hello!”}
]
)
print(completion)
2
curl --request POST
–url https://api.gpts.vin/v1/chat/completions/
–header ‘Authorization: Bearer sk-xxx’
–header ‘content-type: application/json’
–data ‘{
“model”: “gpt-4”,
“messages”: [
{
“role”: “user”,
“content”: “say 1”
}
]
}’
3
curl --request POST
–url https://api.gpts.vin/v1/chat/completions
–header ‘Authorization: Bearer sk-xxx’
–header ‘content-type: application/json’
–data ‘{
“messages”: [
{
“role”: “user”,
“content”: [
{
“type”: “text”,
“text”: “题目是什么”
},
{
“type”: “image_url”,
“image_url”: {
“url”: “https://pics4.baidu.com/feed/f31fbe096b63f62430fdd9e135548ef51b4ca34a.jpeg@f_auto?token=bd2415d6c1c854c59b59a590b8bc3447”
}
}
]
}
],
“max_tokens”: 3000,
“temperature”: 1,
“top_p”: 1,
“n”: 1,
“stream”: false,
“presence_penalty”: 0,
“frequency_penalty”: 0,
“model”: “gpt-4-vision-preview”
}’
4
openai.api_key = “sk-OIm6zIBeWFyvPvOyFfB07e9f5bB949F3A331635f52C56064”
openai.api_base = “https://api.gpts.vin/v1”;
5
openai.api_base = ‘https://api.gpts.vin/v1’
openai.api_key = ‘sk-xxxxxxxxxxx’
res = openai.Image.create(
prompt=‘Cat’
)
print(res)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。