Hi. I've been at it for a while, and i'm getting more and more confused.
I tried developping my first ever api on some C#. I created my first ever request:
string apiUrl = "https://api.openai.com/v1/completions";
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
var requestBody = new
{
model = "gpt-3.5-turbo",
messages = new[]
{
new { role = "system", content = "You're the goat" },
new { role = "user", content = "say that you're the goat" }
}
};
var content = new StringContent(JsonConvert.SerializeObject(requestBody), Encoding.UTF8, "application/json");
try
{
var response = await client.PostAsync(apiUrl, content);
var responseString = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode)
{
Console.WriteLine("API : " + responseString);
}
else
{
Console.WriteLine($"Error {response.StatusCode}: {responseString}");
}
}
catch (Exception ex)
{
Console.WriteLine("Error : " + ex.Message);
}
Just this, right in my Main function.
Too Many Requests, it would seem. I'm on free plan and on my usage it says i used 0 out of 5$ i have; and the response headers don't even have some "rate remaining" or something. Please can someone lend me a hand?