An unofficial API for Character AI for Python using Playwright
If you have any questions or just want to chat about character.ai, go to Telegram chat
pip install characterai
For using library, you should get token
- Log in on character.ai
- Go to
Network
tab in DevTools and refresh page - Search
/dj-rest-auth/auth0/
- Copy
key
value
This is a character ID, it's very easy to get it
- Open any chat
- Copy
char
value from URL
Simple program for chatting with character
from characterai import pyCAI
token = 'TOKEN'
character = 'CHAR'
client = pyCAI(token)
while True:
send = input('You: ')
print(f'Character: {client.chat.send_message(character, send)}')
For information about the user, namely about you via a token, the answer is json
user.info()
user.posts()
user.followers()
user.following()
For character information, the answer is json
character.trending()
character.recommended()
character.categories()
character.get_info('CHAR')
To work with the chat, get_history
answer is json
chat.get_history('CHAR')
chat.send_message('CHAR', 'YOUR MESSAGE')
- The only library for character.ai
- Asynchronous
- So easy to use
This library is written by a beginner in python, if you have any problems, write to me in Telegram