Class Client

The FakeYou API client. This is the main entry point for the library. It provides methods to fetch data from the FakeYou API.

Example: ```ts import { Client } from 'fakeyou.ts'; const client = new Client(); // Optional await client.login({ username: 'username', password: 'password' }); ```

Constructors

Properties

cache: Cache<CacheKey> = ...
rest: Rest = ...

Methods

  • Fetch all available categories which hold TTS models and child categories.

    Returns Promise<Category[]>

    A list of all available categories including their child categories.

  • Fetch a category by its token. Categories are used to group TTS models together. NOTE: Voice conversion models are not grouped into categories so this method will not return any voice conversion model categories.

    Parameters

    • token: string

      The token of the category to fetch.

    Returns Promise<undefined | Category>

    The category or undefined if no category was found.

  • Fetch all category to model relationships. This is used to determine which models belong to which categories.

    Returns Promise<Record<string, string[]>>

    An object where the key is the category token and the value is an array of model tokens.

  • Fetch the current FakeYou TTS queue and other related information.

    This is the number of jobs that are currently waiting to be processed by the FakeYou TTS engine.

    The result is cached for 15 seconds.

    Returns Promise<Queue>

    The queue.

  • Fetch all root categories which hold TTS models and child categories. Root categories are categories which have no parent category.

    Returns Promise<Category[]>

    A list of all root categories.

  • Fetch a model by its display name. Case insensitive.

    This method will return the first model that contains the search string in its title. This may not return the right model you are after if there are multiple models with the same substring, so it is recommended to use fetchTtsModelByToken if you know the token of the model.

    Parameters

    • search: string

      The search string (case insensitive).

    Returns Promise<undefined | TtsModel>

    The model or undefined if no model was found.

  • Fetch a single TTS model by its token.

    Parameters

    • token: string

      The token of the model to fetch. You can find this in the URL of the model page.

    Returns Promise<undefined | TtsModel>

    The model.

  • Fetch all available TTS models.

    This method will return all models available on the website.

    Returns Promise<Map<string, TtsModel>>

    A map of all available models with their token as the key.

  • Fetch all models created by a user.

    Parameters

    • username: string

      The username of the user, this is not the display name and is case sensitive.

    Returns Promise<TtsModel[]>

    An array of all models created by the user. Empty array if no models were found.

  • Fetch an isolated TTS result by a result token. The result token can be found in the object returned from an inference, or on the website!

    Parameters

    • token: string

      The token of the result to fetch.

    Returns Promise<undefined | TtsResult>

    The TTS result or undefined if no result was found.

  • Fetch a user profile by their username.

    Parameters

    • username: string

      The username of the user to fetch. This is not the display name and is case sensitive.

    Returns Promise<undefined | ProfileUser>

    The user profile, or undefined if the user does not exist.

  • Fetch a voice conversion model by its display name. Case insensitive. This method will return the first model that contains the search string in its title. This may not return the right model you are after if there are multiple models with the same substring, so it is recommended to use fetchV2vModelByToken if you know the token of the model.

    Parameters

    • search: string

      The search string (case insensitive)

    Returns Promise<undefined | V2vModel>

    The model or undefined if no model was found

  • Fetch a voice conversion model by its token. This is tricker to locate, as it is not displayed in the UI or in the URL. You can find the token by inspecting the network requests on the FakeYou website or by using fetchV2vModelByName and making note of the token.

    Parameters

    • token: string

      The token of the model to fetch.

    Returns Promise<undefined | V2vModel>

    The voice conversion model.

  • Fetch all available voice conversion models.

    This method will return all models available on the website.

    Returns Promise<Map<string, V2vModel>>

    A map of all available models with their token as the key.

  • Fetch all voice-to-voice models created by a user's username.

    Parameters

    • username: string

      The username of the user

    Returns Promise<V2vModel[]>

    An array of all models created by the user

  • Login in with your provided credentials to take advantage of any potential premium benefits.

    This uses session cookies to authenticate you.

    API token authentication is not supported due to the lack of support for it in the API and it not being available to the public. If you work for FakeYou and can provide a token to test with and want help add support for it, please get in touch.

    Parameters

    • credentials: {
          password: string;
          username: string;
      }

      Your credentials to login with. Email is supported.

      • password: string
      • username: string

    Returns Promise<void>

    Rejects

    If the credentials are invalid.

  • Logout of your account. Permanently invalidates the session cookie. Use client.login() to create a new session.

    Returns Promise<boolean>

    Whether the logout was successful.

Generated using TypeDoc