API calls to code-davinci-002 so slow

code-davinci-002 is really slow when calling api. But in web playground, it works quite fast. Is there any reason why using the api is slow?

What is the max_tokens set to in your API call?
Usually larger max_tokens leads to longer response time.

Feel free to share the code making the API call.