Skip to main content

Async Python client library for AI Horde

Installation:

Warning: supports only Python 3.11 or later

python3.11 -m pip install aihorde

Usage examples

Image generation

import asyncio
from aihorde.client import AIHordeClient
from aihorde import models

API_KEY = '0000000000' # Your API key from aihorde.net/register. You can also use 0000000000.

async def image():
    q = input('Введите запрос: ')
    client = AIHordeClient(API_KEY)
    generation_input = models.GenerationInputStable(
        q,
        models=['Anything v5', 'Anything v3', 'MeinaMix', 'Cetus-Mix', 'Anything Diffusion',
                'AAM XL', 'AlbedoBase XL (SDXL)', 'Animagine XL', 'Anime Illust Diffusion', 'DreamShaper XL',
                'ICBINP XL', 'Juggernaut XL', 'Quiet Goodnight XL', 'Unstable Diffusers XL']
    )
    generations: list[models.GenerationStable] = (await client.generate_image(generation_input)).generations
    for generation in generations:
        print(f'{generation.model}: {generation.img}')

asyncio.run(image())

Text generation

import asyncio
from aihorde.client import AIHordeClient
from aihorde import models

API_KEY = '0000000000' # Your API key from aihorde.net/register. You can also use 0000000000.

async def text():
    q = input('Введите запрос: ')
    client = AIHordeClient(API_KEY)
    params = models.ModelGenerationInputKobold(
        stop_sequence=['Human:'],
        max_length=160
    )
    generation_input = models.GenerationInputKobold(
        f' Human: {q}/n AI:',
        params=params,
        models=['koboldcpp/Kunoichi-DPO-v2-7B-Q8_0-imatrix'] # i dont know which models are good for text :D
    )
    results: list[models.GenerationKobold] = (await client.generate_text(generation_input)).generations
    for result in results:
        print(result.text.strip())

asyncio.run(text())

Get active models list

import asyncio
from aihorde.client import AIHordeClient
from aihorde import models

API_KEY = '0000000000' # Your API key from aihorde.net/register. You can also use 0000000000.

async def models():
    client = AIHordeClient(API_KEY)
    active_models: list[models.ActiveModel] = await client.get_models(type='image') # or 'text'
    print(repr(active_models))

asyncio.run(models())

Metadata

Release files for aihorde 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aihorde 0.3
File Size Uploaded
aihorde-0.3.tar.gz 19.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aihorde 0.3
File Interpreter ABI Platform
aihorde-0.3-py3-none-any.whl Python 3 none any Details

Total release size: 39.2 kB

Release files / aihorde-0.3.tar.gz

Download URL aihorde-0.3.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b8bf1602305e68dca6e5b26dfad95d82a18507d84ea272fdacfb09ba7a7030b7
BLAKE2b-256 checksum
How to use checksums
5dddfbff2ffb6c9bd506584a699d3a0ecddbf2cd4d644b5552f0f53bdccd6d0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release files / aihorde-0.3-py3-none-any.whl

Download URL aihorde-0.3-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bbb161374ea5d5191552114b80c418aaaa48382c1856f1a281d0aaac15f0c0e6
BLAKE2b-256 checksum
How to use checksums
41124acc5db99f00ac59e99818fd7861eed49d2223f5df8d6cafa92e58d14719
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release history Release notifications | RSS feed

This release

0.3 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page