Skip to content

jan-oratowski/Knedlex.StableHorde.Api

Repository files navigation

Knedlex.StableHorde.Api - the C# library for the AI Horde

The API documentation for the AI Horde

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: 2.0
  • SDK version: 1.0.0
  • Generator version: 7.4.0
  • Build package: org.openapitools.codegen.languages.CSharpClientCodegen

Frameworks supported

  • .NET Core >=1.0
  • .NET Framework >=4.6
  • Mono/Xamarin >=vNext

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.

Installation

Generate the DLL using your preferred tool (e.g. dotnet build)

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using Knedlex.StableHorde.Api.Api;
using Knedlex.StableHorde.Api.Client;
using Knedlex.StableHorde.Api.Model;

Usage

To use the API client with a HTTP proxy, setup a System.Net.WebProxy

Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using Knedlex.StableHorde.Api.Api;
using Knedlex.StableHorde.Api.Client;
using Knedlex.StableHorde.Api.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();
            config.BasePath = "/api";
            var apiInstance = new V2Api(config);
            var filterId = "filterId_example";  // string | 
            var apikey = "apikey_example";  // string | A mod API key.
            var clientAgent = "\"unknown:0:unknown\"";  // string | The client name and version. (optional)  (default to "unknown:0:unknown")
            var xFields = "xFields_example";  // string | An optional fields mask (optional) 

            try
            {
                // Moderator Only: Delete a regex filter
                SimpleResponse result = apiInstance.DeleteFilterSingle(filterId, apikey, clientAgent, xFields);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling V2Api.DeleteFilterSingle: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to /api

Class Method HTTP request Description
V2Api DeleteFilterSingle DELETE /v2/filters/{filter_id} Moderator Only: Delete a regex filter
V2Api DeleteImageAsyncStatus DELETE /v2/generate/status/{id} Cancel an unfinished request
V2Api DeleteInterrogationStatus DELETE /v2/interrogate/status/{id} Cancel an unfinished interrogation request
V2Api DeleteOperationsBlockWorkerIp DELETE /v2/operations/block_worker_ipaddr/{worker_id} Remove a worker's IP block
V2Api DeleteOperationsIp DELETE /v2/operations/ipaddr Remove an IP from timeout
V2Api DeleteSharedKeySingle DELETE /v2/sharedkeys/{sharedkey_id} Delete an existing SharedKey for this user
V2Api DeleteTeamSingle DELETE /v2/teams/{team_id} Delete the team entry
V2Api DeleteTextAsyncStatus DELETE /v2/generate/text/status/{id} Cancel an unfinished request
V2Api DeleteWorkerSingle DELETE /v2/workers/{worker_id} Delete the worker entry
V2Api GetFilterRegex GET /v2/filters/regex Moderator Only: A List all filters, or filtered by the query
V2Api GetFilterSingle GET /v2/filters/{filter_id} Moderator Only: Display a single filter
V2Api GetFilters GET /v2/filters Moderator Only: A List all filters, or filtered by the query
V2Api GetFindUser GET /v2/find_user Lookup user details based on their API key
V2Api GetHeartbeat GET /v2/status/heartbeat If this loads, this node is available
V2Api GetHordeLoad GET /v2/status/performance Details about the current performance of this Horde
V2Api GetHordeModes GET /v2/status/modes Horde Maintenance Mode Status
V2Api GetHordeNews GET /v2/status/news Read the latest happenings on the horde
V2Api GetImageAsyncCheck GET /v2/generate/check/{id} Retrieve the status of an Asynchronous generation request without images
V2Api GetImageAsyncStatus GET /v2/generate/status/{id} Retrieve the full status of an Asynchronous generation request
V2Api GetImageHordeStatsModels GET /v2/stats/img/models Details how many images were generated per model for the past day, month and total
V2Api GetImageHordeStatsTotals GET /v2/stats/img/totals Details how many images have been generated in the past minux,hour,day,month and total
V2Api GetInterrogationStatus GET /v2/interrogate/status/{id} Retrieve the full status of an interrogation request
V2Api GetModelSingle GET /v2/status/models/{model_name} Returns all the statistics of a specific model in this horde
V2Api GetModels GET /v2/status/models Returns a list of models active currently in this horde
V2Api GetOperationsIp GET /v2/operations/ipaddr Return all existing IP Block timeouts
V2Api GetOperationsIpSingle GET /v2/operations/ipaddr/{ipaddr} Check if an IP or CIDR is in timeout
V2Api GetSharedKeySingle GET /v2/sharedkeys/{sharedkey_id} Get details about an existing Shared Key
V2Api GetTeamSingle GET /v2/teams/{team_id} Details of a worker Team
V2Api GetTeams GET /v2/teams A List with the details of all teams
V2Api GetTextAsyncStatus GET /v2/generate/text/status/{id} Retrieve the full status of an Asynchronous generation request
V2Api GetTextHordeStatsModels GET /v2/stats/text/models Details how many texts were generated per model for the past day, month and total
V2Api GetTextHordeStatsTotals GET /v2/stats/text/totals Details how many texts have been generated in the past minux,hour,day,month and total
V2Api GetUserSingle GET /v2/users/{user_id} Details and statistics about a specific user
V2Api GetUsers GET /v2/users A List with the details and statistic of all registered users
V2Api GetWorkerSingle GET /v2/workers/{worker_id} Details of a registered worker
V2Api GetWorkers GET /v2/workers A List with the details of all registered and active workers
V2Api PatchFilterSingle PATCH /v2/filters/{filter_id} Moderator Only: Modify an existing regex filter
V2Api PatchSharedKeySingle PATCH /v2/sharedkeys/{sharedkey_id} Modify an existing Shared Key
V2Api PatchTeamSingle PATCH /v2/teams/{team_id} Update a Team's information
V2Api PostAesthetics POST /v2/generate/rate/{id} Submit aesthetic ratings for generated images to be used by LAION and Stability
V2Api PostAwardKudos POST /v2/kudos/award Awards Kudos to registed user
V2Api PostFilters POST /v2/filters Moderator Only: Check The suspicion of the provided prompt
V2Api PostImageAsyncGenerate POST /v2/generate/async Initiate an Asynchronous request to generate images
V2Api PostImageJobPop POST /v2/generate/pop Check if there are generation requests queued for fulfillment
V2Api PostImageJobSubmit POST /v2/generate/submit Submit a generated image
V2Api PostInterrogate POST /v2/interrogate/async Initiate an Asynchronous request to interrogate an image
V2Api PostInterrogatePop POST /v2/interrogate/pop Check if there are interrogation requests queued for fulfillment
V2Api PostInterrogateSubmit POST /v2/interrogate/submit Submit the results of an interrogated image
V2Api PostOperationsIp POST /v2/operations/ipaddr Add an IP or CIDR to timeout
V2Api PostTeams POST /v2/teams Create a new team
V2Api PostTextAsyncGenerate POST /v2/generate/text/async Initiate an Asynchronous request to generate text
V2Api PostTextJobPop POST /v2/generate/text/pop Check if there are generation requests queued for fulfillment
V2Api PostTextJobSubmit POST /v2/generate/text/submit Submit generated text
V2Api PostTransferKudos POST /v2/kudos/transfer Transfer Kudos to another registed user
V2Api PutFilters PUT /v2/filters Moderator Only: Add a new regex filter
V2Api PutHordeModes PUT /v2/status/modes Change Horde Modes
V2Api PutOperationsBlockWorkerIp PUT /v2/operations/block_worker_ipaddr/{worker_id} Block worker's from a specific IP for 24 hours
V2Api PutSharedKey PUT /v2/sharedkeys Create a new SharedKey for this user
V2Api PutUserSingle PUT /v2/users/{user_id} Endpoint for horde admins to perform operations on users
V2Api PutWorkerSingle PUT /v2/workers/{worker_id}

Documentation for Models

Documentation for Authorization

Endpoints do not require authorization.