#I get HTTP 404 (Not Found)

4 messages · Page 1 of 1 (latest)

azure summit
#
-- Require the HTTP module
local HttpService = game:GetService("HttpService")

-- Your OpenAI API key
local apiKey = ""

-- The endpoint URL for the GPT-3.5 API
local apiUrl = "https://api.openai.com/v1/engines/gpt-3.5-turbo/completions"

-- The function to send a request to the GPT-3 API and receive a response
local function sendRequest(prompt)
    -- Set up the request body
    local requestBody = {
        prompt = prompt,
        max_tokens = 60,
        temperature = 0.5,
        n = 1,
        stop = "\n"
    }

    -- Encode the request body as JSON
    local requestBodyJson = HttpService:JSONEncode(requestBody)

    -- Set up the HTTP headers
    local headers = {
        ["Authorization"] = "Bearer " .. apiKey
    }

    -- Send the HTTP request
    local response = HttpService:PostAsync(apiUrl, requestBodyJson, Enum.HttpContentType.ApplicationJson, false, headers)

    -- Decode the JSON response
    local responseData = HttpService:JSONDecode(response)

    -- Return the generated text
    return responseData.choices[1].text
end

-- Example usage
local prompt = "Hello, how are you?"
local generatedText = sendRequest(prompt)
script.Parent.TextLabel.Text = generatedText

here is my code

#

if i do no api key it return 401, with api key return 404

azure summit
#

after i upgrade it change to HTTP 400 (Bad Request)