Metadata-Version: 2.5
Name: axlet
Version: 0.1.0
Summary: Python client for the Axlet subscription and credits API
Project-URL: Homepage, https://axlet.app
License-Expression: LicenseRef-Proprietary
License-File: LICENSE
Keywords: axlet,credits,sdk,subscriptions
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# Axlet Python SDK

Server-side Python client for the Axlet subscription, entitlement, credits, and purchase APIs. Python 3.10 or later; no runtime dependencies.

```sh
pip install axlet
```

```python
import os
from axlet import AxletClient, AxletApiError

client = AxletClient(
    api_key=os.environ["AXLET_API_KEY"],
    base_url=os.environ.get("AXLET_API_URL", "http://127.0.0.1:4310"),
)
print(client.get_plans())
```

Use an Axlet API server you operate or have access to. `axlet.app` is a website, not a hosted public API endpoint. This package does not include the API server. Keep operator API keys on your server.

## Usage

Methods use Python snake_case names. Input and response dictionaries preserve API camelCase fields:

```python
customer = client.create_customer(
    {"name": "Example", "email": "user@example.com", "externalId": "user-123"},
    idempotency_key="create-user-123",
)
access = client.get_access(customer["id"], "report")
# For each paid operation, confirm successful consumption before doing the work.
usage = client.consume_usage(
    customer["id"],
    {"feature": "report", "operationId": "report-job-123"},
    idempotency_key="consume-job-123",
)
```

Every mutation requires an idempotency key. Keys and operation IDs must contain 8–100 ASCII letters, digits, underscores, or hyphens. Reuse them only for retries of the same operation; generate new IDs for new work. The customer must have the required subscription or credits before consuming paid usage.

Supported methods: `get_plans`, `set_plan`, `create_customer`, `register_billing`, `subscribe`, `cancel`, `refund`, `retry`, `get_entitlement`, `get_credits`, `get_access`, `consume_usage`, `cancel_usage`, `create_purchase`, `get_purchase`, `confirm_purchase`, `sync_purchase`, `refund_purchase`, `advance_demo`, and `run_jobs`.

HTTP failures and invalid successful responses raise `AxletApiError` with `status` and `body`. Invalid keys raise `ValueError`. Network errors use the standard library's exceptions. Socket operations use a 75-second timeout, configurable with `timeout=`. Requests are synchronous, redirects are rejected, and no automatic retries are performed. Payment behavior depends on the API server configuration; installing this client does not enable production payments.

## License

All rights reserved. This release does not grant an open-source license.
