const url = 'https://api.keywordsai.co/api/request-logs/create/';
const headers = {
'Authorization': 'Bearer YOUR_KEYWORDS_AI_API_KEY',
'Content-Type': 'application/json'
};
const payload = {
model: 'gpt-4o',
log_type: 'chat',
input: JSON.stringify([
{
role: "user",
content: "How can I help a customer with a billing issue?"
}
]),
output: JSON.stringify({
role: "assistant",
content: "I'd be happy to help with billing issues. First, let me check your account details..."
}),
customer_identifier: "support_agent_001"
};
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => {
console.log(data);
});