1
Answer

how to use OpenAi

umair mohsin

umair mohsin

May 10
479
1

i have login to open AI using gmail account created an api key but as my account is free i am getting some error 429. how to handle this thing i dont want to pay for this. I am using devinci 002 model and hitting some queries(questions) inmy app

is there any way to use ai for free. i am an extreme newbie of AI.help me out please

Answers (1)
-1
Lokendra Singh

Lokendra Singh

253 7.3k 69.8k May 10

Recently i was using devinci 003 model using python it works for me.

Here is the code that it might help you.

import openai

openai.api_key = "YOUR_OPENAI_API_KEY"

# Example prompt
prompt = "What is AI?"

# Specify the "text-davinci-003" model
response = openai.Completion.create(
    engine="text-davinci-003",
    prompt=prompt,
    max_tokens=150,  # number of words
    n=1,
    stop=None,
    temperature=0.7,  # Control creativity (0: deterministic, 1: maximum randomness)
)

print(response.choices[0].text)
Next Recommended Forum