// Run this in Node.js, not a browser playground
const fetch = require('node-fetch'); // If using Node < 18
async function callOpenRouter() {
const response = await fetch("https://openrouter.ai/api/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_NEW_API_KEY", // Replace with a new key
"Content-Type": "application/json"
},
body: JSON.stringify({
"model": "google/gemini-3-flash-preview",
"messages": [
{ "role": "user", "content": "How many r's are in the word 'strawberry'?" }
],
"include_reasoning": true // Use the correct field for the specific provider
})
});
const result = await response.json();
console.log(result.choices[0].message);
}
callOpenRouter();