Skip to content

Commit a967291

Browse files
authored
Merge pull request #295255 from dlepow/ailog
[APIM] LLM logging
2 parents f0c3ac1 + 6e6510f commit a967291

15 files changed

+41
-196
lines changed

articles/api-management/TOC.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -624,10 +624,6 @@
624624
- name: Azure Policy built-ins
625625
displayName: samples, policies, definitions
626626
href: ./policy-reference.md
627-
- name: Gateway log schema
628-
href: gateway-log-schema-reference.md
629-
- name: Developer portal audit log schema
630-
href: developer-portal-audit-log-schema-reference.md
631627
- name: Event Grid events schema
632628
href: ../event-grid/event-schema-api-management.md?toc=/azure/api-management/toc.json&bc=/azure/api-management/breadcrumb/toc.json
633629
- name: Virtual network configuration
@@ -636,8 +632,6 @@
636632
href: self-hosted-gateway-settings-reference.md
637633
- name: Self-hosted gateway Azure Arc configuration
638634
href: self-hosted-gateway-arc-reference.md
639-
- name: Diagnostic logs settings
640-
href: diagnostic-logs-reference.md
641635
- name: Resources
642636
items:
643637
- name: FAQ

articles/api-management/developer-portal-audit-log-schema-reference.md

Lines changed: 0 additions & 57 deletions
This file was deleted.

articles/api-management/diagnostic-logs-reference.md

Lines changed: 0 additions & 49 deletions
This file was deleted.

articles/api-management/gateway-log-schema-reference.md

Lines changed: 0 additions & 73 deletions
This file was deleted.

articles/api-management/genai-gateway-capabilities.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ In API Management, enable semantic caching by using Azure Redis Enterprise, Azur
104104
> [!TIP]
105105
> To enable semantic caching for other LLM APIs, API Management provides the equivalent [llm-semantic-cache-store-policy](llm-semantic-cache-store-policy.md) and [llm-semantic-cache-lookup-policy](llm-semantic-cache-lookup-policy.md) policies.
106106
107+
## Logging token usage, prompts, and completions
108+
109+
Enable a [diagnostic setting](monitor-api-management.md#enable-diagnostic-setting-for-azure-monitor-logs) in your API Management instance to log requests processed by the gateway for large language model REST APIs. For each request, data is sent to Azure Monitor including token usage (prompt tokens, completion tokens, and total tokens), name of the model used, and optionally the request and response messages (prompt and completion). Large requests and responses are split into multiple log entries that are sequentially numbered for later reconstruction if needed.
110+
111+
The API Management administrator can use LLM gateway logs along with API Management gateway logs for scenarios such as the following:
112+
113+
* **Calculate usage for billing** - Calculate usage metrics for billing based on the number of tokens consumed by each application or API consumer (for example, segmented by subscription ID or IP address).
114+
* **Inspect messages** - To help with debugging or auditing, inspect and analyze prompts and completions.
115+
116+
Learn more about [monitoring API Management with Azure Monitor](monitor-api-management.md).
107117

108118
## Content safety policy
109119

0 commit comments

Comments
 (0)