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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aihorde-0.3.tar.gz | 19.9 kB | Without provenance | Details for aihorde-0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aihorde-0.3-py3-none-any.whl | Python 3 | none | any | Details for aihorde-0.3-py3-none-any.whl |
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
|
Security for aihorde 0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.