Metadata-Version: 2.4
Name: janitorai
Version: 0.1.0
Summary: Unofficial Python SDK for JanitorAI - Create, chat with, and manage AI characters
Home-page: https://github.com/byewawa7-source/janitor
Author: Community Developer
Author-email: Community Developer <jackellerson@outlook.dk>
License: MIT
Project-URL: Homepage, https://github.com/byewawa7-source/janitor
Project-URL: Repository, https://github.com/byewawa7-source/janitor
Project-URL: Documentation, https://github.com/byewawa7-source/janitor#readme
Project-URL: Issues, https://github.com/byewawa7-source/janitor/issues
Keywords: janitorai,ai,chatbot,characters,api,sdk
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.0
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# JanitorAI Python SDK

**Unofficial Community SDK** - Interact with JanitorAI's character chat platform programmatically.

> ⚠️ **Not Official**: This is a community-maintained SDK, not affiliated with JanitorAI. Use at your own risk.

## Installation

```bash
pip install janitorai
```

## Quick Start

```python
import janitorai

# 1. Login (Email/Password is simplest)
token = janitorai.login(
    email="your_email@example.com",
    password="your_password"
)

# 2. Create API client
api = janitorai.JanitorAPI(token)

# 3. Browse characters
characters = api.characters.list_characters(search="anime", page=1)
print(f"Found {len(characters)} characters!")

# 4. Start chatting
character = characters[0]
chat = api.chats.create_chat(character.id)

# 5. Send a message
user_msg = api.chats.post_message(chat.id, "Hello!", is_bot=False)

# 6. Generate AI response
messages = [{
    "id": user_msg["id"],
    "chat_id": chat.id,
    "character_id": character.id,
    "is_bot": False,
    "is_main": True,
    "message": "Hello!",
    "created_at": user_msg["created_at"]
}]

response = api.llm.generate(chat.id, character.id, messages)
print(f"🤖 {response}")
```

## Requirements

- **Python**: 3.8 or higher
- **Internet**: Active connection to JanitorAI API
- **Account**: Valid JanitorAI account

## Community Project

This SDK is maintained by the community and is **not officially supported** by JanitorAI. Features may break if the API changes. Always comply with JanitorAI's Terms of Service.

- 📖 **Documentation**: [GitHub Repository](https://github.com/byewawa7-source/janitor)
- 🐛 **Issues**: [Report Bugs](https://github.com/byewawa7-source/janitor/issues)
- 💬 **Community**: [JanitorAI Discord](https://discord.gg/janitorai) (Not the modules discord server)

## Features

### 🔐 Authentication
- **Email/Password**: Simple login for most users
- **OAuth PKCE**: Secure authentication for advanced use
- **Token Management**: Automatic handling of JWT tokens

### 👥 Character Management
- **Browse & Search**: Find characters by name, tags, popularity
- **Create Custom**: Build your own AI characters
- **Edit & Update**: Modify character details and settings
- **Publish Control**: Make characters public or private

### 💬 Chat System
- **Start Conversations**: Create chat sessions with any character
- **Message History**: Maintain conversation context
- **Real-time Chat**: Send messages and get AI responses

### 🤖 AI Generation
- **Context Aware**: Uses full conversation history
- **Character Consistency**: Responses match character personality
- **Streaming Support**: Real-time response generation

### 🛡️ Security & Reliability
- **Input Validation**: Safe parameter handling
- **Rate Limiting**: Built-in request throttling
- **Error Handling**: Comprehensive exception management
- **Timeout Protection**: Prevents hanging requests
