Unresponsive IP Address for api.openai.com

I wrote a small c# program to access text-davinci-002 and when I ran it I got a 404 error in response. I then tried a more direct approach and used POSTMAN to submit my GET request:

https://api.openai.com/v1/text/generate?prompt=What is the best tempurature for baking short bread cookies?&model=text-davinci-003&temperature=0.5&max_tokens=1024

and that too returned a 404 Not Returned error.

I verified the outbound using Fiddler4 and I even asked chatgpt if my url was correct (it said yes) and I do have a valid APIKey.

When I did a ping of the url I got timeouts?

and this whether on or off vpn.

My question is, is that the right base url (api.openai.com) or should I use something else? If it was authentication or a bad syntax I figure I get a different error. The c# code for the request I got from chatGPT so maybe it is outdated?

As you can see from the other post, ChatGPT isn’t the best way to learn coding for a specific API.

It’s best to stick with the docs and API examples.

https://beta.openai.com/docs/api-reference/completions/create

[

## Create completion

post https://api.openai.com/v1/completions

Creates a completion for the provided prompt and parameters
3 Likes

Well, that was embarrassing, but then not that far off from some of the answers I may read on stackoverflow at times. perhaps what is slightly frustrating are that the examples are only for node.js and python. I should have c# web requests coding memorized by now, but as a data integrator just coming off SOAP, it is not build in yet. Let’s see if I can get this working now.

(Also, I normally don’t like to ask it “Please write me code I should understand”, but I was trying to save time).

1 Like

No worries. Yours wasn’t half as bad as some of the requests we get around here! :wink:

In all seriousness, feel free to post something if you run into trouble. We’re all still learning …

1 Like

I still think, man that seemed so right (lol). Okay, using POSTMAN I get that the body is JSON established parameters. I have the body set to application/json and I am sending this:

{
“model”: “text-davinci-002”,
“prompt”: “What is the best tempurature for baking short bread cookies”,
“max_tokens”: 100,
“temperature”: .5,
“n”: 1,
“stream”: false,
“logprobs”: null,
“stop”: “\n”
}

My response is this:

{
“error”: {
“message”: “you must provide a model parameter”,
“type”: “invalid_request_error”,
“param”: null,
“code”: null
}
}

with my actual request (GET) looking like this:

GET https://api.openai.com/v1/completions HTTP/1.1
Authorization: Bearer
Content-Type: application/json
User-Agent: PostmanRuntime/7.29.2
Accept: /
Cache-Control: no-cache
Postman-Token: 9ebb4e96-5438-4e28-9d42-eb023993ad50
Host: api.openai.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 226

{
“model”: “text-davinci-002”,
“prompt”: “What is the best tempurature for baking short bread cookies”,
“max_tokens”: 100,
“temperature”: .5,
“n”: 1,
“stream”: false,
“logprobs”: null,
“stop”: “\n”
}

I can get a list of models, 002 is in the list. If I can get this working in POSTMAN translating it to c# is no issue. I fell like I am missing something from the documentation.

Needs to be a POST request not GET, I believe…

[

Create completion

](https://beta.openai.com/docs/api-reference/completions/create)

POST https://api.openai.com/v1/completions

Creates a completion for the provided prompt and parameters

(Seems I cannot read after 40+ years programming. Actually I’m just frustrated and was rushing)

I did get a response, but

{
“error”: {
“message”: “You exceeded your current quota, please check your plan and billing details.”,
“type”: “insufficient_quota”,
“param”: null,
“code”: null
}
}

I guess I need to read up on what that means now though is seems like am Amazon throttling thing. Thank you for your guidance.

There is a quota. You might need to fill in your billing details too…

Looks like you’re getting closer, tho! :wink:

Slow and steady…I was just going to go there and I am set up as Personal. According to them it’s 20 a min and I did not have one yet.

Yes. Users on the Free trial have an organization-level rate limit set to 20 requests/minute and 150,000 tokens/minute.

I tried added Personal as the OpenAI-Organization but it did not seem to like that. Perhaps I’ll try a new API Key (sigh)