APIs ‐ Bot API Functions - altoiddealer/ad_discordbot GitHub Wiki

This section of the dict_api_settings.yaml configuration establishes which API the bot will use for each "main function", including unknown APIs so long as instructions are followed carefully.

Screenshot

Screenshot 2025-06-09 163320

Usage Instructions:

Required:

  • Define new APIs in main section "all_apis", then link them by name (case sensitive!!)

  • Ensure each "endpoint_name" matches

Known APIs:

The remainder of this config section can otherwise be largely ignored for known APIs, as the expected handling is executed on the backend.

ImGen: Automatic1111 / Forge / ReForge / ComfyUI

TextGen: (not applicable yet)

TTSGen: Alltalk


For unknown APIs:

  • Comment out or set null value for any data in this section which is N/A for the API (ex: Commenting/removing 'post_options' will disable posting imgmodel change params)
  • You may need to research the input/output structure for your API endpoints to configure "_key" values. ('response_handling' can also be used to return expected value types - more on this below)
  • The extra "_key" values in this section (ei: 'output_file_path_key') are intended to simplify common expected API behavior, but ARE NOT REQUIRED. Example scenario: Your main TTS client's 'post_generate' endpoint returns raw data (bytes). The bot's main functions need the file path. ...What should I do? - Set 'output_file_path_key: null' (or remove the line) - Define a "response_handling" for this endpoint (in 'all_apis') so it returns a file path after the last 'step'

Expected Value Types:

ImgGen Client

Endpoint Class Method Expected Input Expected Output Comment
post_txt2img POST dictionary, with keys like prompt, negative_prompt, seed list of images (base64 or bytes)
post_img2img POST dictionary, with keys like prompt, negative_prompt, seed list of images (base64 or bytes)
get_progress GET None dictionary with keys: progress (required), eta (optional), max (optional)
post_pnginfo POST dictionary, with key for image (base64) dictionary with key: info (image generation parameters string) image is sent as base64
post_options POST dictionary, with key for image model (string) confirmation response (often ignored unless error checking)
get_imgmodels GET None list of strings, or list of dictionaries with keys: model_name, title, filename (at least one)
get_controlnet_models GET None list of available ControlNet model names or IDs
post_server_restart POST None or minimal payload (depends on API) confirmation message or server response post-restart polls get_progress after posting until a response is found
get_controlnet_control_types GET None dictionary with key control_types (maps to controlnet model category data) See example payload
post_upload POST Multipart payload type, including data and files (bot script handles the files) None See example payload
get_history GET None list of previous generation records or history objects ComfyUI only
get_view GET query parameters (usually referencing an ID) detailed generation result or image metadata ComfyUI only

TextGen Client

Not yet supported. Text gen can be accomplished by integrated Text Generation WebUI installation method.

Alternatively, text can be generated by APIs using Tags system.

Endpoint Class Method Expected Input Expected Output

TTSGen Client

Endpoint Class Method Expected Input Expected Output
get_voices GET None dictionary with key voices (list of available voice names as strings)
get_languages GET None dictionary with key languages (list of available language names as strings)
post_generate POST dictionary with keys: text_input (required, string), language (optional, string), character_voice_gen (optional, string) bytes, or dictionary with key output_file_path (string path to generated audio file)
⚠️ **GitHub.com Fallback** ⚠️