Skip to main content

togai-client

PyPI

Togai is an end to end pricing infrastructure that enable you with metering, aggregating, pricing and billing for your application.

This is an official Typescript client library for using Togai APIs.

Requirements.

Python 3.8+

Installation & Usage

pip install

pip install togai-client

(you may need to run pip with root permission: sudo pip install togai-client)

Then import the package:

import togai_client

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import togai_client

Getting Started

Please follow the installation procedure and then run the following: You will need a API_TOKEN to use the API. You can get one from your Togai Account

import time
import togai_client
from pprint import pprint
from togai_client.api import accounts_api
from datetime import datetime
from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Optional, Union
from typing_extensions import Annotated
from togai_client.models.account import Account
from togai_client.models.account_aliases_paginated_response import AccountAliasesPaginatedResponse
from togai_client.models.account_paginated_response import AccountPaginatedResponse
from togai_client.models.add_account_aliases_request import AddAccountAliasesRequest
from togai_client.models.base_success_response import BaseSuccessResponse
from togai_client.models.create_account_request import CreateAccountRequest
from togai_client.models.create_proposal_request import CreateProposalRequest
from togai_client.models.create_purchase_request import CreatePurchaseRequest
from togai_client.models.edit_pricing_schedule_request import EditPricingScheduleRequest
from togai_client.models.get_proposal_response import GetProposalResponse
from togai_client.models.get_purchase_response import GetPurchaseResponse
from togai_client.models.pricing_schedule_paginated_response import PricingSchedulePaginatedResponse
from togai_client.models.proposal import Proposal
from togai_client.models.proposals_paginated_response import ProposalsPaginatedResponse
from togai_client.models.purchase import Purchase
from togai_client.models.purchase_paginated_list_data import PurchasePaginatedListData
from togai_client.models.remove_account_aliases_request import RemoveAccountAliasesRequest
from togai_client.models.update_account_request import UpdateAccountRequest
from togai_client.models.update_pricing_schedule_request_with_actions import UpdatePricingScheduleRequestWithActions
from togai_client.models.update_pricing_schedule_response import UpdatePricingScheduleResponse
from togai_client.models.update_proposal_status import UpdateProposalStatus
# Defining the host is optional and defaults to https://api.togai.com
# See configuration.py for a list of all supported configuration parameters.
configuration = togai_client.Configuration(
    host = "https://api.togai.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization (Bearer <credential>): bearerAuth
configuration = togai_client.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)


# Enter a context with an instance of the API client
with togai_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = accounts_api.AccountsApi(api_client)
    account_id = 'ACC00001' # str | account_id corresponding to an account
    add_account_aliases_request = togai_client.AddAccountAliasesRequest() # AddAccountAliasesRequest | Payload to add aliases to account

    try:
        # Add Aliases to account
        api_response = api_instance.add_aliases(account_id, add_account_aliases_request)
        pprint(api_response)
    except togai_client.ApiException as e:
        print("Exception when calling AccountsApi->add_aliases: %s\n" % e)

You can get a detailed step-by-step guide for a sample ingestion and metering at examples directory For a more detailed documentation for every api and models, please refer to the docs directory

Author

engg@togai.com

Release files for togai-client 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for togai-client 1.0.3
File Size Uploaded
togai_client-1.0.3.tar.gz 230.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for togai-client 1.0.3
File Interpreter ABI Platform
togai_client-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 1.1 MB

Release files / togai_client-1.0.3.tar.gz

Download URL togai_client-1.0.3.tar.gz
Size 230.6 kB
Tags Source
SHA-256 checksum
How to use checksums
445c0be6d8c7d1db6d30685ff004d23b72f9a5d2b5df82656d453191923f8a1b
BLAKE2b-256 checksum
How to use checksums
3087f4e911897e91748b3f3fe2f1df7fc943249c56a0627e646e2d3c2d7cf19d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.0

Release files / togai_client-1.0.3-py3-none-any.whl

Download URL togai_client-1.0.3-py3-none-any.whl
Size 839.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f17327e2b61e3a56c5b54bc52ef7a78e424847281aa9ebbf2df4691fc2b648ac
BLAKE2b-256 checksum
How to use checksums
3a307fbf3266d7cd00387b928728262862a612c48d476a8168355453cb0c821c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.0

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page