Code viewer for World: AnimImagine image generato...
//Get option from AI API (Gets Models)

const url = 'https://animimagine-ai.p.rapidapi.com/fetchModels';
const get_options = {
	method: 'GET',
	headers: {
		'X-RapidAPI-Key': '4f66f2c7f5msh4f1386696862d1ep11a7d4jsn4e0e94eea6c4',
		'X-RapidAPI-Host': 'animimagine-ai.p.rapidapi.com'
	}
};

fetch(url, get_options).then(res => res.json().then(data => {
    console.log(data);
  }));


//POST option from AI API (generates Image)

async function test(){
    const url = 'https://animimagine-ai.p.rapidapi.com/generateImage';
    const post_options = {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-RapidAPI-Key': '4f66f2c7f5msh4f1386696862d1ep11a7d4jsn4e0e94eea6c4',
      'X-RapidAPI-Host': 'animimagine-ai.p.rapidapi.com',
    },
    body: JSON.stringify({
      selected_model_id: 'anything-v5',
      selected_model_bsize: '512',
      prompt: 'girl in space',
    }),
  };
  
  try {
    const response = await fetch(url, post_options);
    const result = await response.json();
    console.log(result);
  } catch (error) {
      console.error(error);
    
  }
}

test();

document.write(`<h1> View Console</h1><p>Post request takes longer so might need to wait few seconds</p>`);