ai

Here's an example of fetching an ai image with the ai endpoint. All images returned are precompiled.

Fetching an ai image

Get an ai image & its details.

GET https://nekos.pro/api/ai

{
    "id": 670,
    "url": "https://cdn.nekos.pro/ai/01863aa9e7454cdabfaaec47d1fe205d.webp"
}

Python example:

import aiohttp

headers = {'Content-type': 'application/json'}
async with aiohttp.ClientSession(headers=headers) as session:
    async with session.get('https://nekos.pro/api/ai') as resp:
        image = await resp.json()
        print(image['url'])

This example assumes you are using asyncio & running a Discord bot, which you should be using instead of requests, which is blocking.

Last updated