Skip to main content

A Python wrapper for Chipp API

Project description

💳 Chipp.ai for Python

⚡ Building the pay-per-generation monetization platform for AI applications ⚡

PyPI version Downloads Documentation Status Twitter

Be sure to sign up for an account and complete Stripe onboarding at https://app.chipp.ai

Installation

pip install chippai

Dependencies

This package requires requests for making API calls. However, it will be automatically installed when you install the chippai package using pip.

Usage

from chippai import Chipp

chipp = Chipp(api_key="your-api-key-from-Chipp-dashboard")

# userId needs to come from your database or auth session
user = chipp.get_user(user_id="a-unique-identifier-for-user")

# If the user is None, the user does not exist in the Chipp system and needs to be created
if user is None:
    user = chipp.create_user(user_id="a-unique-identifier-for-user")

# Get the number of credits remaining for this user
num_chipps = user.get_credits()

# Deduct credits from this user
user.deduct_credits(1)

# Generate a payment URL where this user can choose their preferred packages of credits and buy more.
# Pass in a redirect URL to bring your user back to your app after the user payment succeeds
url = user.get_packages_url(return_to_url="https://your-app.com/wherever-user-was")

Further Documentation

For a more detailed guide and advanced usage patterns, refer to the official documentation.

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

chippai-0.1.2.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

chippai-0.1.2-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

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