Sponsored

openwebui_token_tracking.sponsored.create_sponsored_allowance(database_url, sponsor_id, name, models, total_credit_limit, daily_credit_limit)[source]
Parameters:
openwebui_token_tracking.sponsored.delete_sponsored_allowance(database_url=None, allowance_id=None, name=None)[source]

Delete a sponsored allowance by ID or name.

Parameters:
  • database_url (str, optional) – The database connection URL. If None, uses the DATABASE_URL environment variable.

  • allowance_id (str, optional) – The ID of the sponsored allowance to delete.

  • name (str, optional) – The name of the sponsored allowance to delete.

Raises:
  • ValueError – If neither allowance_id nor name is provided.

  • ValueError – If no sponsored allowance is found with the given ID or name.

openwebui_token_tracking.sponsored.get_sponsored_allowance(database_url=None, name=None, id=None)[source]

Get a single sponsored allowance by name or ID.

Parameters:
  • database_url (str, optional) – The database connection URL. If None, uses the DATABASE_URL environment variable.

  • name (str, optional) – The name of the allowance to retrieve.

  • id (str, optional) – The ID of the allowance to retrieve.

Returns:

The sponsored allowance as a dictionary.

Return type:

dict

Raises:

KeyError – If no allowance is found with the given name or ID.

openwebui_token_tracking.sponsored.get_sponsored_allowances(database_url=None, sponsor_id=None)[source]

Get all sponsored allowances, optionally filtered by sponsor ID.

Parameters:
  • database_url (str, optional) – The database connection URL. If None, uses the DATABASE_URL environment variable.

  • sponsor_id (str, optional) – Filter allowances by sponsor ID.

Returns:

List of sponsored allowances, each as a dictionary.

Return type:

list[dict]

openwebui_token_tracking.sponsored.update_sponsored_allowance(database_url=None, allowance_id=None, name=None, new_name=None, sponsor_id=None, models=None, total_credit_limit=None, daily_credit_limit=None)[source]

Update a sponsored allowance by ID or name.

Parameters:
  • database_url (str, optional) – The database connection URL. If None, uses the DATABASE_URL environment variable.

  • allowance_id (str, optional) – The ID of the sponsored allowance to update.

  • name (str, optional) – The name of the sponsored allowance to update.

  • new_name (str, optional) – The new name for the sponsored allowance.

  • sponsor_id (str, optional) – The new sponsor ID for the sponsored allowance.

  • models (Iterable[str], optional) – The new list of base model IDs.

  • total_credit_limit (int, optional) – The new total credit limit.

  • daily_credit_limit (int, optional) – The new daily credit limit.

Raises:
  • ValueError – If neither allowance_id nor name is provided.

  • ValueError – If no sponsored allowance is found with the given ID or name.