Azure OpenAI quota monitor. It will turn your OpenAI quota to minimum (1k tokens/minute) if the total spent on thet resource cross a defined threshold.
-
Install vscode extensions:
- Python (
ms-python.python
) - Azure Functions (
ms-azuretools.vscode-azurefunctions
) - Azurite (
azurite.azurite
)
- Python (
-
Start Azurite Storage emulator
Ctrl+Shift+P
, then typeAzurite: Start
-
Create the file
local.settings.json
{ "IsEncrypted": false, "Values": { "AzureWebJobsStorage": "UseDevelopmentStorage=true", "FUNCTIONS_WORKER_RUNTIME": "python", "SUBSCRIPTION_ID": "VALUE HERE", "RESOURCE_GROUP": "VALUE HERE", "OPENAI_ID": "RESOURCE NAME HERE", "OPENAI_DEPLOYMENT": "VALUE HERE", "BUDGET_THRESHOLD": "VALUE HERE (in USD)" } }
-
Open the file
ChackBilling/__init__.py
-
Run it with
F5
- vscode will assk to install all tooling required to run it locally.