Skip to main content

Code Sample

To facilitate seamless integration with APIRE.IO, we provide code sample in Java Script, demonstrating how to interact with our API. Additionally, we offer Software Development Kits (SDKs) to streamline development processes.


JavaScript (Node.js)​

const axios = require('axios');

const apiKey = 'YOUR_API_KEY';
const endpoint = 'https://api.apire.io/api/prompts';

const data = {
prompt: "Hello world!",
token: apiKey,
options: {
max_tokens: 100,
frequency_penalty: 0,
presence_penalty: 0,
temperature: 1
}
};

axios.post(endpoint, data, {
headers: {
'Authorization': `Apikey ${apiKey}`,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error.response ? error.response.data : error);
});