You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
An code that uses ChatGPT api to give responses
- What is the issue? Include screenshots / videos if possible!
When i try in studio, it works perfectly
But when i try in-game, it gives me the error HTTP 400 (Bad request)
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Yes, but i didnt found any solutions
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that itβs easier for people to help you!
function RawAiResponse(Input:string,Tokens:string,Stop:string?)
local HTTP = game:GetService("HttpService")
local url = "https://api.pawan.krd/v1/completions"
local key = "my key"
local headers = {
["Authorization"] = key,
}
local body = HTTP:JSONEncode({
model = "text-davinci-003";
prompt = Input;
temperature = 0.5;
max_tokens = Tokens or 256;
stop = Stop or {
"Human:";
"IA:"
};
})
local response = HTTP:PostAsync(url, body, Enum.HttpContentType.ApplicationJson, nil, headers)
local decoded = HTTP:JSONDecode(response)
return decoded
end
print(RawAiResponse("Hello ChatGPT, AI:"))
Please do not ask people to write entire scripts or design entire systems for you. If you canβt answer the three questions above, you should probably pick a different category.