Dynamo + chatGPT

Hi all,
i’m currently trying to work whit the Dynamo package " DynamoChatGPT " developed by Maycon Freitas for add chatGPT into the Dynamo workflow, problem is that i always get the same error, even if my setup seems to be same to the Maycon’s one.

THE SCRIPT:

THIS IS THE ERROR I GET:

image

THIS IS THE LINK (linkedIn post by Maycon Freitas)

i think is not an error due two the dynamo script but some how whit the internet page of chat maybe??? any idea?

thank you all !

i don’t use this package, but as the error says, Too Many Request, maybe check whats the maximum it can take and/or contact the developer

The developer has dropped support and left the code on github a while back, so it might depend on the version of GPT you are using as well. No doubt they built against 3 or earlier.

Can log an issue here anyway:

1 Like

To date, I haven’t found any solution on the internet, is there anyone who has downloaded the package and knows how to solve this error?
or some programmer who understands what is going wrong?

THIS IS THE ERROR:

[
[
Traceback (last call last):
File “”, line 139, in
File “”, line 107, in create_completion
File “C:\Users\f.amman\AppData\Roaming\Dynamo\Dynamo Revit\2.19\packages\DynamoIronPython2.7\extra\IronPython.StdLib.2.7.9\urllib2.py”, line 154, in urlopen
return opener.open(url, data, timeout)
File “C:\Users\f.amman\AppData\Roaming\Dynamo\Dynamo Revit\2.19\packages\DynamoIronPython2.7\extra\IronPython.StdLib.2.7.9\urllib2.py”, line 435, open
response = meth(request, response)
File “C:\Users\f.amman\AppData\Roaming\Dynamo\Dynamo Revit\2.19\packages\DynamoIronPython2.7\extra\IronPython.StdLib.2.7.9\urllib2.py”, line 547, in http_response
response = self.parent.error(
File “C:\Users\f.amman\AppData\Roaming\Dynamo\Dynamo Revit\2.19\packages\DynamoIronPython2.7\extra\IronPython.StdLib.2.7.9\urllib2.py”, line 473, in error
return self._call_chain(*args)
File “C:\Users\f.amman\AppData\Roaming\Dynamo\Dynamo Revit\2.19\packages\DynamoIronPython2.7\extra\IronPython.StdLib.2.7.9\urllib2.py”, line 407, in _call_chain
result = function(*args)
File “C:\Users\f.amman\AppData\Roaming\Dynamo\Dynamo Revit\2.19\packages\DynamoIronPython2.7\extra\IronPython.StdLib.2.7.9\urllib2.py”, line 556, in http_error_default
raise HTTP error(req.get_full_url(), code, msg, hdrs, fp)
HTTP Error: HTTP Error 429: Too many requests

]
]

image

In general, most REST APIs impose a requests limit. (requests per minute, per days, etc…)

here is the documentation for open AI

https://platform.openai.com/docs/guides/rate-limits/free-tier-rate-limits

2 Likes

Looks like you’ve been rate limited. See here: 429 Too Many Requests - HTTP | MDN

The exact number of requests which is permissible varies by service, but my guess is that unless you’re paying for the service you’ve exceeded your limit, perhaps just in making the connection via Dynamo instead of by the service’s standard portal. Per @c.poupin’s link above you get 3 requests per minute for a GPT3.5 instance with the free tier before you’re limited, and the base code on the package may be making 3 requests just to confirm access, effectively ensuring you have to pay to make it work.


i’m using the free version of gpt 3.5, but even if i make a single request whit very short prompt it give me the error.

the base code on the package may be making 3 requests just to confirm access, effectively ensuring you have to pay to make it work

i have also tried whit a paid version of chat 4-0 but give me the same error, is there anybody whit pro gpt account that can try this script and help foind a solution?

i attach the script here

DYNAMO SCRIOPT
Base nodes for ChatGPT + Dynamo.dyn (47.5 KB)

Hi f.amman, I have just tested your script and it works.

Make sure you have an account in the API section of the OpenAI website (which is different from having a ChatGPT/ChatGPT Pro subscription that is what you used). Then you should top-up your balance (€/$), and finally you can generate your personal API-KEY, get your Organization-ID and using them.

Here the login page of OpenAI:

and here is the output from your script:

Let me know if you have any questions.

4 Likes

It looks like you’re running into the classic HTTP Error 429: Too many requests. This means that you (or your script) made too many requests to the remote server in a short time, and it started throttling traffic to avoid being overloaded.

Here are some things to try:

Pause between requests: Add a delay (time.sleep(1) or more) between urlopen() calls to reduce the request rate.

API key or limits: If you’re using an external API, make sure you have a key and that you’re not exceeding the request limit. Sometimes you need to sign up and use a personal access token.

Error handling: Add exception handling around urlopen() - if you get a 429, you can wait a bit and try again.

Python example:

python

import time
import urllib2

def safe_request(url):
for attempt in range(3):
try:
return urllib2.urlopen(url)
except urllib2.HTTPError as e:
if e.code == 429:
print("Too many requests, waiting before retry...")
time.sleep(5)
else:
raise

If you use an external package or module, check if it has the ability to set headers, such as User-Agent - sometimes this helps bypass restrictions.

If you give more context (what URL is this, where it comes from, and how create_completion() is called), we can offer a more specific solution.