Credits
- class titanq.credits.CreditDetails(credits: int, start_date: datetime.datetime, expiration_date: datetime.datetime)
- __init__(credits: int, start_date: datetime, expiration_date: datetime) None
- class titanq.credits.CreditsSummary(available_credits: List[CreditDetails], total_available_credits: int, upcoming_credits: List[CreditDetails] | None)
The summary of credits information returned by the backend on credits request.
Attributes
- available_credits
A list of CreditDetails objects representing credits that are still valid.
- total_available_credits
The total amount of available credits.
- upcoming_credits
A list of CreditDetails objects representing credits that have not yet started. This can be None if there are no upcoming credits.
- __init__(available_credits: List[CreditDetails], total_available_credits: int, upcoming_credits: List[CreditDetails] | None) None
- titanq.credits.get_credits_summary(api_key: str | None = None, base_server_url: str = 'https://titanq.infinityq.io') CreditsSummary
Query the amount of remaining credits and summarize available and upcoming credits.
Parameters
- api_key
TitanQ API key to access the service. If not set, it will use the environment variable
TITANQ_API_KEY
- base_server_url
TitanQ API server url, default set to
https://titanq.infinityq.io
.
Returns
- CreditsSummary
An object containing the list of available credits, the total available credits, and the list of upcoming credits (if any).
Raises
- MissingTitanqApiKey
If no API key is set and is also not set as an environment variable