@@ -439,35 +439,35 @@ The tool needs three required inputs: **RPM** (requests per minute), **avg input
439439
440440#### Option A — Azure CLI (no Log Analytics)
441441
442- Copy-paste this script — it queries the last 7 days and prints your three inputs :
442+ Pull the last 24 hours of metrics from your Azure OpenAI resource :
443443
444444``` bash
445- # Replace {sub}, {rg}, {name} with your values
445+ # Set your resource ID
446446RES=" /subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.CognitiveServices/accounts/{name}"
447- START=$( date -u -d " 7 days ago" +%Y-%m-%dT%H:%M:%SZ)
448- END=$( date -u +%Y-%m-%dT%H:%M:%SZ)
449447
450- REQS=$( az monitor metrics list --resource " $RES " --metric AzureOpenAIRequests \
451- --aggregation Total --interval P7D --start-time " $START " --end-time " $END " \
452- --query " value[0].timeseries[0].data[0].total" -o tsv)
448+ # Total requests (split by model deployment)
449+ az monitor metrics list --resource $RES \
450+ --metric AzureOpenAIRequests --aggregation Total \
451+ --interval PT1H --dimension ModelDeploymentName
453452
454- INPUT= $( az monitor metrics list --resource " $RES " --metric ProcessedPromptTokens \
455- --aggregation Total --interval P7D --start-time " $START " --end-time " $END " \
456- --query " value[0].timeseries[0].data[0].total " -o tsv )
453+ # Total input (prompt) tokens
454+ az monitor metrics list --resource $RES \
455+ --metric ProcessedPromptTokens --aggregation Total --interval PT1H
457456
458- OUTPUT=$( az monitor metrics list --resource " $RES " --metric GeneratedTokens \
459- --aggregation Total --interval P7D --start-time " $START " --end-time " $END " \
460- --query " value[0].timeseries[0].data[0].total" -o tsv)
457+ # Total output (completion) tokens
458+ az monitor metrics list --resource $RES \
459+ --metric GeneratedTokens --aggregation Total --interval PT1H
460+ ```
461461
462- PEAK=$( az monitor metrics list --resource " $RES " --metric AzureOpenAIRequests \
463- --aggregation Total --interval PT1H --start-time " $START " --end-time " $END " \
464- --query " max(value[0].timeseries[0].data[].total)" -o tsv)
462+ Then compute your averages:
465463
466- echo " === Your PTU Sizing Inputs ==="
467- echo " rpm: $( echo " $PEAK / 60" | bc) "
468- echo " avg_input_tokens: $( echo " $INPUT / $REQS " | bc) "
469- echo " avg_output_tokens: $( echo " $OUTPUT / $REQS " | bc) "
470464```
465+ avg_input_tokens = total_prompt_tokens / total_requests
466+ avg_output_tokens = total_completion_tokens / total_requests
467+ RPM = peak_hour_requests / 60
468+ ```
469+
470+ > ** Tip:** You can also view these metrics visually in ** Azure Portal → your OpenAI resource → Monitoring → Metrics** .
471471
472472#### Option B — KQL (requires Log Analytics)
473473
0 commit comments