Loading...
Convert cURL commands to fetch, axios or Python requests
const response = await fetch('https://api.openai.com/v1/chat/completions', {
method: 'POST',
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer sk-proj-12345"
},
body: "{\n \"model\": \"gpt-4o-mini\",\n \"messages\": [\n {\"role\": \"user\", \"content\": \"Hello world!\"}\n ]\n }",
});
const data = await response.json();
console.log(data);