Metadata-Version: 2.4
Name: aimemoryapi
Version: 0.1.0
Summary: Official Python SDK for AI Memory API
Project-URL: Homepage, https://www.aimemoryapi.com
Project-URL: Documentation, https://docs.aimemoryapi.com
Author: AI Memory API
License: MIT
License-File: LICENSE
Requires-Python: >=3.8
Requires-Dist: pydantic>=2.0.0
Requires-Dist: requests>=2.31.0
Provides-Extra: dev
Requires-Dist: mypy>=1.0; extra == 'dev'
Requires-Dist: pytest-mock>=3.12; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# AI Memory Python SDK

**Official Python SDK for [AI Memory API](https://www.aimemoryapi.com)** — persistent memory for AI agents.

## Installation

```bash
pip install aimemoryapi
```

## Quick Start

```python
from aimemoryapi import AiMemory

client = AiMemory()

# Register a user (starts 7-day free trial)
user = client.users.register(
    user_id="my_user_001",
    email="user@example.com",
)

# Create a project
project = client.projects.create(
    user_id="my_user_001",
    name="My AI Project",
)

# Start a session
session = client.sessions.start(
    user_id="my_user_001",
    project_id=project["id"],
)

# Add messages
client.messages.add(
    session_id=session["id"],
    role="user",
    content="Hello, AI!",
)

# Retrieve session context
full_session = client.sessions.get(session["id"])
print(f"Messages: {full_session['messageCount']}")
```

## Resources

| Resource    | Method             | API Endpoint                    |
|-------------|--------------------|---------------------------------|
| `health`    | `check()`          | `GET /health`                   |
| `metrics`   | `get()`            | `GET /metrics`                  |
| `tiers`     | `list()`           | `GET /api/tiers`                |
| `users`     | `register()`       | `POST /api/register`            |
| `trial`     | `status()`         | `GET /api/trial/status/:id`     |
| `trial`     | `checkout()`       | `POST /api/trial/checkout`      |
| `projects`  | `create()`         | `POST /api/project`             |
| `sessions`  | `start()`          | `POST /api/session`             |
| `sessions`  | `get()`            | `GET /api/session/:id`          |
| `messages`  | `add()`            | `POST /api/message`             |

## Error Handling

```python
from aimemoryapi.errors import (
    AuthenticationError,
    InvalidRequestError,
    APIError,
)

try:
    client.users.register(user_id="user_1")
except AuthenticationError as e:
    print(f"Auth error: {e}")
except InvalidRequestError as e:
    print(f"Invalid request: {e}")
except APIError as e:
    print(f"Server error: {e}")
```

## Requirements

- Python 3.8+
- `requests` >= 2.31.0
- `pydantic` >= 2.0.0

## Links

- [Website](https://www.aimemoryapi.com)
- [Documentation](https://docs.aimemoryapi.com)
- [PyPI](https://pypi.org/project/aimemoryapi/)
