Metadata-Version: 2.1
Name: characterai
Version: 0.8.0
Summary: An unofficial API for character.ai for Python
Home-page: https://github.com/kramcat/characterai
Author: kramcat
Classifier: Programming Language :: Python :: 3.9
Classifier: License :: OSI Approved :: MIT License
Description-Content-Type: text/markdown
License-File: LICENSE

# 💬 CharacterAI
![Tag](https://img.shields.io/github/license/kramcat/CharacterAI)
[![Downloads](https://static.pepy.tech/badge/characterai/month)](https://pepy.tech/project/characterai)

An unofficial API for Character AI for Python using Playwright

### Discord Server
If you have any questions/problems/suggestions or you just want to talk about AI and CharacterAI - welcome to my new Discord server

[**discord.gg/ZHJe3tXQkf**](https://discord.gg/ZHJe3tXQkf)

 ᅠ 

## 💻 Installation
```bash
pip install characterai
```

 ᅠ 

## 📚 Documentation
For a complete understanding of the library, there is [documentation](https://pycai.gitbook.io/welcome/)
 ᅠ 

## 🔑 Get Token
DO NOT SHARE IT
The token is needed for authorization and operation of requests from your account
1. Open DevTools in your browser
2. Go to Storage -> Local Storage -> char_token
3. Copy `value`

 ᅠ 

## 📙 Example
```Python
from characterai import PyCAI

client = PyCAI('TOKEN')

char = input('Enter CHAR: ')

chat = client.chat.get_chat(char)

participants = chat['participants']

if not participants[0]['is_human']:
    tgt = participants[0]['user']['username']
else:
    tgt = participants[1]['user']['username']

while True:
    message = input('You: ')

    data = client.chat.send_message(
        chat['external_id'], tgt, message
    )

    name = data['src_char']['participant']['name']
    text = data['replies'][0]['text']

    print(f"{name}: {text}")
```

 ᅠ 

## ⚠️ Issues
Describe how to cause an error, when the error is called, how often, whether it was before, etc.
You can write about the error in Github Issues, and you can also write to Discord server
