How to Get Free Janitor AI API

Have you ever wanted to chat with your favourite fictional character, or create your own character and scenario, using a powerful and realistic AI? If so, you might have heard of Janitor AI, a website that lets you do just that.

In this article, we will explain how to use Janitor AI with Poe AI and Claude 2 AI for free, how they work together, and how you can set them up on your device.

How to Use Janitor AI for Free?

Janitor AI is a chatbot website that uses GPT-3 to allow you to communicate with any fictitious character you desire or construct your own.

You can select from a range of genres, customize your character’s name, appearance, personality, backstory, and so on, and utilize prompts to guide the conversation in any path you desire.

Janitor AI differs from other chatbot websites in that it uses GPT-3, which can generate capable of generating sentences based on any input.

Use Open AI with Python Poe API?

Python Poe API is a free and open-source project that acts as a reverse proxy for OpenAI, allowing you to access OpenAI’s ChatGPT and GPT-4 models. A reverse proxy is a server that sits between a client and a backend server and handles client requests on the backend server’s behalf.

Python Poe API addresses these issues by changing Free Janitor AI API and OpenAI requests and responses, such as dividing long requests into smaller ones, concatenating short responses into longer ones, and filtering out undesired stuff.

Installation

Run the following command to install Python Poe API:

pip3 install poe-api

This library is dependent on quickjs, which does not provide Python 3.11 prebuilt binaries. Pip will try to compile it but will fail if you don’t have python-dev installed.

For more details about installation refer github.

On Windows and MacOS

Python-dev should be included in your existing Python installation on Windows and MacOS.

See also  How to Use Discord AI Art Generator: Top 7 Servers You Should Join in 2023

Documentation

Examples can be found in the /examples directory. Pass your token as a command-line input to execute these examples. To enter the following command:

python3 examples/temporary_message.py “TOKEN_HERE”

Finding Your Poe Token

  • Use any desktop web browser to access Poe.
  • Open the developer tools in your browser (commonly known as “inspect”).
  • Navigate to the Application tab in the developer tools.
  • Look for the p-b cookie under the Cookies area.
  • The p-b cookie’s value is your Poe token.

Excessive use of the Python Poe API may result in the suspension of your account. It is advised that you create your own rate limitations and utilize an alternate account that you do not value. See issue #118 for further information.

Making Use of the Client

You must first import the poe module before you can utilize the Client class. Then, using your token and any other optional inputs, you can build a new Client instance. The following arguments can be passed to the Client constructor:

token: This is your Poe token.

proxy = None: The proxy to be used in the protocol format: protocol://host:port The device ID that will be used. The socks5h protocol is recommended, as it also proxies the DNS queries.

device ID = None: The device ID to use. If this is not specified, it will be randomly generated and stored on the disk.

headers = headers : The headers that should be used. The headers supplied in the poe.headers module are used by default.

client_identifier = client identifier: The client identifier supplied to the TLS client library. This is the one supplied in the poe.client_identifier module by default.

formkey = None : The formkey to be used. Only use this option if the client cannot be initialized without it. This value can be found by opening your browser’s devtools, searching the network tab for a gql_POST request, and taking the value of the poe-formkey request header. Keep in mind that Chromium 112 is the default browser.

Regular Example:

import poe client = poe.Client(“TOKEN_HERE”)

Proxied Example:

import poe client = poe.Client(“TOKEN_HERE”, proxy=”socks5h://178.62.100.151:59166″)

Please keep in mind that the following examples assume client is the name of your poe.Instance of a client. A RuntimeError will be thrown if the token is invalid.

See also  How to Create Unstable Diffusion Undress AI Images

Downloading the Available Bots

When you launch the client, it downloads a list of all available bots. The client.bots dictionary stores this list, which maps bot codenames to display names. You can use the client.get_bots() function to update the list of accessible bots.

print(json.dumps(client.bot_names, indent=2)) “”” { “capybara”: “Assistant”, “chinchilla”: “ChatGPT”, “beaver”: “GPT-4”, “a2_100k”: “Claude-instant-100k”, “a2”: “Claude-instant”, “agouti”: “ChatGPT-16k”, “a2_2”: “Claude-2-100k”, “acouchy”: “Google-PaLM” } “””

Using Third-Party Bots

You can use the client.explore_bots() function to acquire a list of third-party bots. This function accepts two parameters:

end_cursor: The cursor that will be used to fetching the list.count: The number of returning bots.

The client.explore_bots() function will return a dict containing a list of bots as well as the page cursor. The cursor is a string that can be used to navigate to the next bot page.

print(json.dumps(client.explore_bots(count=1), indent=2)) “”” { “bots”: [ { “id”: “Qm90OjEwMzI2MDI=”, “displayName”: “leocooks”, “deletionState”: “not_deleted”, “image”: { “__typename”: “UrlBotImage”, “url”: “https://sdigi.net/wp-content/uploads/2023/09/how-to-get-free-janitor-ai-api.jpeg” }, “botId”: 1032602, “followerCount”: 1922, “description”: “Above average meals for average cooks, made simple by world-renowned chef, Leonardo”, “__typename”: “Bot” } ], “end_cursor”: “1000172” } “””

You can utilise client to obtain a certain third-party bot.get_bot_by_codename, which takes only the bot’s codename as an argument.

client.get_bot_by_codename(“JapaneseTutor”)

Creating New Bots

You can use the client to create a new bot.The create_bot function takes the following arguments:

handle – The new bot’s handle.

prompt = “” – The new bot’s prompt.

display_name = None – The new bot’s display name.

description = “” – The new bot’s description.

If you want the new bot to utilise your own API (as described here), use the following arguments:

api_key = None – The new bot’s API key.api_bot = False – Indicates if the bot has API functionality enabled.api_url = None – The new bot’s API URL.Examples/create_bot.py has a complete example of how to create and edit bots.

new_bot = client.create_bot(bot_name, “prompt goes here”, base_model=”a2″)

Editing a Bot

The client allows you to edit a custom bot. The edit_bot method takes the following arguments:

bot_id – The botId to be edited. This option is also available as None.handle – The bot’s handle that you’re editing.prompt – The bot’s new prompt.new_handle = None – The bot’s new handle. The handle will not change by default.display_name = None – The bot’s new display name.description = “” – The bot’s new description.

See also  10 Insane Blocked Prompts in Bing Chat and Bing Image Creator

Bot API Arguments

The client.create_bot() and client.edit_bot() procedures accept two bot API-related arguments:

api_key: The bot’s API key.api_url: The bot’s API URL.

edit_result = client.edit_bot(1086981, “bot_handle_here”, base_model=”a2″)

Sending Messages

You can use the client.send_message() function to send a message to a chatbot.

message = “Summarize the GNU GPL v3” for chunk in client.send_message(“capybara”, message): print(chunk[“text_new”], end=””, flush=True)

Non-Streamed Example:

message = “Summarize the GNU GPL v3” for chunk in client.send_message(“capybara”, message): pass print(chunk[“text”])

Clearing the Context of the Conversation

The client.send_chat_break() function can be used to clear the discussion context of a chatbot.

The following code, for example, will clear the discussion context of the chatbot with the codename “capybara“:

client.send_chat_break(“capybara”)

Conversation History Download

You can use the client.get_message_history() function to obtain previous messages in a discussion.

For example, the following code will download the past 25 messages from a conversation with the “capybara” chatbot:

message_history = client.get_message_history(“capybara”, count=10) print(json.dumps(message_history, indent=2)) “”” [ { “node”: { “id”: “TWVzc2FnZToxMDEwNzYyODU=”, “messageId”: 101076285, “creationTime”: 1679298157718888, “text”: “”, “author”: “chat_break”, “linkifiedText”: “”, “state”: “complete”, “suggestedReplies”: [], “vote”: null, “voteReason”: null, “__typename”: “Message” }, “cursor”: “101076285”, “id”: “TWVzc2FnZUVkZ2U6MTAxMDc2Mjg1OjEwMTA3NjI4NQ==” }, … ] “””

Deleting Messages

To delete messages in a chat client, you can use the client.delete_message function. This function accepts a single argument.

You can pass a single message ID into it to delete a single message, or you can pass a list of message IDs to delete multiple messages at once.

#delete a single message client.delete_message(96105719) #delete multiple messages at once client.delete_message([96105719, 96097108, 96097078, 96084421, 96084402])

Getting the Remaining Messages

Use the client.get_remaining_messages function to get the number of messages left in a conversation’s quota. The following arguments are accepted by this function:

>>> client.get_remaining_messages(“beaver”)

Troubleshooting tips

  • Make sure you are logged in to the Poe website with your OpenAI account.
  • Make sure you are using a web browser that has devtools, such as Chrome, Firefox, or Kiwi browser.
  • Make sure you are pasting the cookie value into a text file named “cookie.txt” in the same folder where you installed Poe API.

You can also check out our blog, How to use Janitor AI for Free for more tips and tutorials on How to use Janitor AI Free.

Conclusion

In this article, we have how to get Free Janitor AI API explained, what Python Poe API and Free Janitor AI API are, how they work together, and how you can set them up on your device.

We hope you found this article helpful and informative. If you have any questions or feedback, please feel free to leave a comment below.