npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@zeldafan0225/ai_horde

v5.2.0

Published

A package to interact with the ai horde API

Downloads

25,868

Readme

@zeldafan0225/ai_horde

This package allows you to communicate with the AI Horde API

DISCLAIMER: THIS PACKAGE/REPOSITORY IS IN NO WAY ASSOCIATED TO THE CREATORS OF AI HORDE

Versions 5.0.0 and later

Version 5.0.0 introduces some breaking changes:

  • Node 18.0.0 or higher is required
  • The way some things are exported is changed

It also features an internal restructure to reduce complexity and improve performance.

Bugs

To report bugs please open an issue on GitHub.

Features

  • Configurable Caching
  • Methods for all endpoints on the API V2
  • Default Token
  • Types with comments and explanations (TS)

Features that are currently missing

  • Ratelimit bucket

Contribute

I am always happy about contributions. You can contribute by forking this repository, updating or adding and then creating a pull request. You can contribute by adding new features, optimizing the currently existing code, adding examples or anything else I missed.

How to use

The package exports the class AIHorde which includes basically everything you need, when using typescript you can also export types. The package also exports constant values used in the hordes API request payloads

const { AIHorde } = require("@zeldafan0225/ai_horde");

/*
Create new instance of the ai_horde class to communicate with the rest API
You can configure which cache should contain the data for what time
You can also configure at what interval the cache is checking if there are any data that should be deleted

The class also takes a default token. This is helpful if you want to use this package only using your own token.
The token is not a required argument in any method.

A default API route is also in the contrictor for changing where the requests are directed to (e.g. when using a subdomain like https://test.aihorde.net)
*/
const ai_horde = new AIHorde({
  cache_interval: 1000 * 10,
  cache: {
    generations_check: 1000 * 30,
  },
  client_agent: "My-Project:v0.0.1:My-Contact"
});

// start the generation of an image with the given payload
const generation = await ai_horde.postAsyncImageGenerate({
  prompt: "The legend of Zelda",
});
console.log(generation);

// check the status of your generation using the generations id
const check = await ai_horde.getImageGenerationCheck(generation.id);
console.log(check);

See the auto-generated docs for more info on methods and parameters.