I’m using API Gateway (AWS) for my openai api. If my script has very simple prompt, it works, e.g.
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’
},
body: JSON.stringify({
model: ‘gpt-4o’, // Using the same model from your working example
messages: [
{
role: ‘system’,
content: ‘Write a short adventure story.’
}
],
max_tokens: 200,
temperature: 0.7
})
});
But if it’s a bit more compliated, it doesn’t - I get a 502 error. E.g.
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’
},
body: JSON.stringify({
model: ‘gpt-4o’, // Using the same model from your working example
messages: [
{
role: ‘system’,
content: ‘Write a short adventure story with 5 comprehension questions at the end.’
}
],
max_tokens: 200,
temperature: 0.7
})
});
Increasing the max tokens doesnt help. Any ideas?
Thanks