Open AI chat completions API give 400 bad request error

I am using Open AI chat completions for chat board.

API : https://api.openai.com/v1/chat/completions
Model : gpt-3.5-turbo-16k

My code run on test server and production server but problem is that API working fine in production server and give error on test server even though both code are line to line same.

Usage of API in test server is more than production server.

Anybody faces same issue or know about this?

Look at or log the full response you’ll get a more descriptive error message. 400 error can be caused by many things.

If you’re using JS, wrap your code in a try catch like this and get the message to share here if you still need help resolving the issue.

try {
    const response = await openai.createChatCompletion({
        <.......>
} catch (error) {
    console.error(error.response.data ?? error.message);
}

Now I found which part giving error on test server and not find error on production server

Error occur : Adding twilio dependency

I am using Open AI API and twilio video room API in java spring boot project.

Problem : When I add twilio maven dependency Open AI chat completions API don’t work give 400 bad request error and I remove twilio maven dependency then chat completion APis working fine.

dependency :

com.twilio.sdk twilio 9.9.0 compile

So give me solution how to resolve that and I don’t understand problem on which side.