OpenAI Integration
A single line added to your code makes all the difference
# This example is for v1+ of the openai: https://pypi.org/project/openai/
from openai import OpenAI
client = OpenAI(
# GPTBoost API base URL
base_url = "https://turbo.gptboost.io/v1",
api_key = $OPENAI_API_KEY,
)
response = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "user", "content": "Tell me an interesting fact about pandas"},
],
)
print(response.choices[0].message.content)curl --request POST \
--url https://turbo.gptboost.io/v1/chat/completions \
--header 'Authorization: Bearer $OPENAI_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "user",
"content": "Tell me an interesting fact about koalas!"
}
]
}'
Last updated