How can I track how much Document Intelligence is charging per API call?

Bret Smith 20 Reputation points
2025-10-27T15:43:19.44+00:00

How can I track how much I am being charged per API call to Azure Document Intelligence? I understand that it's being charged per documents processed and not per API call, but nevertheless I would like to know this information. If I am required to enable some sort of logging with Azure Logging Analytics Workspace, how do I go about doing this?

Azure Document Intelligence in Foundry Tools

2 answers

Sort by: Most helpful
  1. Anshika Varshney 15,620 Reputation points Microsoft External Staff Moderator
    2025-10-27T17:55:41.1533333+00:00

    Hi Bret Smith,

    You’re right, Azure Document Intelligence is billed per page processed, not per API call. However, there are a few reliable ways to track usage and estimate cost per call or document depending on how detailed you want your tracking to be.

    1. Track usage in the Azure Portal (simple method):

    Go to your Document Intelligence resource → Monitoring → Metrics.

    Under the “Metric” dropdown, select Processed Pages.

    Set the time range (hourly, daily, monthly) to see how many pages were processed. You can then use the Azure Pricing page for Document Intelligence to multiply the number of pages by your model’s cost per page (Prebuilt, Custom, Layout, etc.) to estimate your charges.

    2. Use Azure Cost Management for actual billing data:

    Go to Cost Management + Billing → Cost Analysis → Filter by your Document Intelligence resource.

    This shows your real billed cost over time, which reflects the total page-based charges.

    3. Enable Diagnostic Logging for detailed tracking (advanced method): If you want to track usage per API call or by user:

    Go to your Document Intelligence resource → Diagnostic Settings (under Monitoring).

    Create a diagnostic setting and send logs to a Log Analytics Workspace.

    In Log Analytics, you can query logs (for example, DocumentAnalysisRequests table) to see request timestamps, model types, and page counts.

    Sample KQL query:

    DocumentAnalysisRequests
    | summarize TotalPages = sum(PageCount) by bin(TimeGenerated, 1d), ModelId
    

    This helps you calculate daily usage or cost by model type.

    So, in short while you can’t see the cost per API call directly, combining Metrics, Cost Management, and Diagnostic Logs gives you full visibility into how much you’re being charged and why.

    Hope this helps clarify how to set it up!

    Was this answer helpful?

    0 comments No comments

  2. Jerald Felix 18,680 Reputation points Volunteer Moderator
    2025-10-27T16:37:25.5133333+00:00

    Hello Bret Smith,

    Tracking costs for Azure Document Intelligence (formerly Form Recognizer) can be a bit nuanced since billing is primarily per document page processed rather than per raw API call, but Azure provides solid tools to monitor usage and estimate charges at a granular level. This helps you correlate API invocations with actual consumption, especially if you're integrating it into apps or workflows where calls might bundle multiple operations. Below, I'll outline the key ways to track this, including enabling diagnostics for deeper insights via Azure Monitor and Log Analytics, so you can avoid surprises in your bill.

    Understanding Billing Basics

    Azure Document Intelligence charges based on the number of pages analyzed in a document, with tiers like Free (limited), Standard (pay-as-you-go at around $1.50 per 1,000 pages for layout models, varying by model type), and committed use discounts for high volume. Each API call to endpoints like Analyze Document typically processes one or more pages, and the charge kicks in upon successful extraction—failed or empty calls don't bill. To track "per API call" effectively, focus on metrics that log call volume alongside page counts, as this gives you a proxy for cost per invocation. Check your current pricing in the Azure portal under Cost Management + Billing > Cost analysis, filtering by the "DocumentIntelligence" service.

    Using Azure Monitor for Real-Time Metrics

    The simplest starting point is Azure Monitor, which captures built-in metrics for Document Intelligence without extra setup. In the Azure portal, navigate to your Document Intelligence resource, select Monitoring > Metrics, and add these key metrics:

    • TotalCalls: Counts API calls (successes and failures), helping you directly track invocation frequency.
    • SuccessfulCalls: Focuses on billed operations.
    • TotalPages: Measures pages processed, which ties straight to your charges (multiply by your tier's per-page rate for estimates).

    Set up alerts here if usage spikes—e.g., notify if TotalCalls exceed a threshold. For cost correlation, switch to Cost Management > Cost analysis and group by API operations or tags; this shows spend broken down by Document Intelligence activities over time. Metrics are available at 1-minute granularity for the last 93 days, so it's great for ongoing tracking without logs.

    Enabling Diagnostic Logs with Log Analytics

    For detailed per-call logging (including API endpoints, timestamps, and response sizes that influence page counts), you'll need to route diagnostics to a Log Analytics workspace—this is what you mentioned, and it's essential for auditing costs beyond aggregates. Here's how to set it up step by step:

    1. In the Azure portal, go to your Document Intelligence resource > Diagnostic settings (under Monitoring).
    2. Click Add diagnostic setting, name it (e.g., "DocIntel-CostTracking"), and select categories like AllMetrics (for calls/pages) and DocumentIntelligenceDiagnosticLogs (for request/response details).
    3. Under Destination, choose Send to Log Analytics workspace and pick or create one (if new, it's a quick setup in the same region).
    4. Save, and logs will start flowing—expect a few minutes for initial data.

    Once enabled (costs ~$2.30/GB ingested), query in the workspace via Logs > New query. Use Kusto Query Language (KQL) like this to track per-call costs:

    
    DocumentIntelligenceDiagnosticLogs
    
    | where TimeGenerated > ago(7d)
    
    | summarize TotalCalls = count(), TotalPages = sum(PagesAnalyzed), EstimatedCost = sum(PagesAnalyzed) * 0.0015 by bin(TimeGenerated, 1h), OperationName
    
    | extend AvgCostPerCall = EstimatedCost / TotalCalls
    
    

    This groups by hour and operation, estimating cost per call based on pages (adjust the rate for your model). Logs include caller IP, model used, and errors, so you can pinpoint inefficient calls. Retention is 30 days by default; extend as needed. For full setup guidance, see Microsoft's docs on monitoring Azure AI services.

    Additional Tips for Cost Optimization

    Tag your resources (e.g., "Project:InvoiceProcessor") to filter costs in reports, and use the Azure Pricing Calculator to simulate scenarios based on your call volume. If you're in development, stick to the Free tier for testing to avoid charges altogether. Integrate with Azure Cost Management budgets to set alerts for Document Intelligence spend—aim for under 10% of your total if it's not core. If high-volume, explore Reserved Capacity for up to 50% savings on predictable workloads.

    This setup should give you clear visibility into charges tied to API calls, making it easier to optimize or forecast. If you share more about your setup (like the models you're using or integration method), I can refine this further.

    Best Regards,

    Jerald Felix

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.