Skip to main content

An unofficial API for character.ai for Python

Project description

CharacterAI

An unofficial API for Character AI for Python using Playwright

Installation

pip install characterai

Get TOKEN

For using library, you should get token

  1. Log in on character.ai
  2. Go to Network tab in DevTools and refresh page
  3. Search /dj-rest-auth/auth0/
  4. Copy key value

Get CHAR

This is a character ID, it's very easy to get it

  1. Open any chat
  2. Copy char= value from URL

Example

Chatting

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)}')

Functions

user

For information about the user, namely about you via a token, the answer is json

user.info()
user.posts()
user.followers()
user.following()

character

For character information, the answer is json

character.trending()
character.recommended()
character.categories()
character.get_info('CHAR')

chat

To work with the chat, get_history answer is json

chat.get_history('CHAR')
chat.send_message('CHAR', 'YOUR MESSAGE')

Features

  • The only library for character.ai
  • Asynchronous
  • So easy to use

Disclaimer

This library is written by a beginner in python, if you have any problems, write to me in Telegram

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

characterai-0.3.2.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file characterai-0.3.2.tar.gz.

File metadata

  • Download URL: characterai-0.3.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.9.6 requests/2.28.2 setuptools/58.1.0 requests-toolbelt/0.10.1 tqdm/4.65.0 CPython/3.9.0rc2

File hashes

Hashes for characterai-0.3.2.tar.gz
Algorithm Hash digest
SHA256 ebb4187325ac4d1dffde288ec181af843f9915aefd01ae3191fec452485b19d2
MD5 2cdd4596f97b7676546612b0067e1879
BLAKE2b-256 06ba4e5036ec1575e04529c5d6ccdc64dce3026c20dd35142876452a43f6c802

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page