Write your prompt and immediately start testing it against your data with our tools
Use your domain knowledge and our infrastructure to easily and quickly add AI to any app.
Use your domain knowledge to write custom prompts. Easily edit and test your prompts in our app to ensure your prompt behaves how you intend.
Using our single API endpoint send text data. One POST request is all it requires.
Setup a WebHook endpoint on your service and we will POST your prompt responses back to you.
var http = require('http');
var crypto = require('crypto');
/*
In order to integrate with Llamahair AI the following is a barebones
implementation. It provides the code required to `validate` your webhook
and for any other requests it prints the request to the console. This
can be handy when developing your full integration.
*/
var server = http.createServer(function (req, res) {
body = "";
req.on('data', function (chunk) {
body += chunk;
});
req.on('end', function () {
try {
var request = JSON.parse(body);
if (request.type === "validate") {
var hash = crypto.createHmac('sha256', process.env.SECRET_KEY);
hash.update(request.timestamp + request.value);
res.write(JSON.stringify({
"code": hash.digest('hex')
}));
res.end();
} else {
/*
{
"id": "example-id-1",
"type": "response",
"identifier": "example-prompt",
"timestamp": 1740360953,
"signature": "dummy" // Sha256(`${id}#{timestamp}${process.env.SECRET_KEY}`)
"response": {
"output": "So simple",
"reasoning": "It's easy to integrate with, so 'So simple' was chosen."
}
}
*/
console.log(request)
res.end()
}
} catch (e) {
console.error(e)
res.end();
}
});
});
server.listen(8000);
const apiUrl = 'https://api.llamahair.ai/v1/in/AF7tqVsykyO721onSL4T_qISvhAm';
async function sendPromptRequest(id, body) {
try {
const timestamp = Math.round((new Date()).getTime() / 1000);
const request = {
llama: {
id,
body
}
};
const response = await fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(request)
});
if (!response.ok) {
throw new Error(`API request failed: ${response.status}`);
}
console.log('Your response should hit your webhook in a couple of seconds!');
} catch (error) {
console.error('Failed to send request:', error);
throw error;
}
}
// Example usage
sendPromptRequest(
'example-id-1',
`Welcome to using Llamahair AI! It's this simple to integrate with our API!`,
).catch(error => {
console.error(error);
});
console.log('Llamahair AI will process your request and send the response to your webook!');