Azure AI foundry model request and response text visibility ?

Sen0299 120 Reputation points
2026-07-02T13:58:11.1566667+00:00

 Is there any option within Azure AI Foundry Portal to see the tokens input and output for a resource API Key. I mean the actual text passed and response received from the model(GPT4.1-mini).

Azure OpenAI in Foundry Models

Answer accepted by question author
Thanmayi Godithi 11,905 Reputation points Microsoft External Staff Moderator
2026-07-02T16:44:17.1066667+00:00

Hi Sen0299 ,

The Azure AI Foundry Portal doesn't have a built-in view that shows the actual prompt and response text by default — the Monitor/Metrics tabs only show counts (request count and token metrics like Processed Prompt Tokens / Generated Completion Tokens), never the message content. Capturing the raw text is opt-in, and it's not retroactive — only calls made after you enable it are captured. You have a few options:

  1. Stored Completions (closest to an in-portal experience) — add store=True to your chat call. The prompt and response are then stored and viewable inside Foundry (and can be reused for distillation/fine-tuning):
completion = client.chat.completions.create(
    model="gpt-4.1-mini",     # your deployment name
    store=True,
    metadata={"user": "admin", "category": "audit"},
    messages=[...]
)

Docs: https://learn.microsoft.com/azure/ai-foundry/openai/how-to/stored-completions

  1. Diagnostic logging to Log Analytics — on the resource, add a Diagnostic Setting to a Log Analytics workspace with RequestResponseLogs enabled, then:
AzureDiagnostics
| where ResourceProvider == "MICROSOFT.COGNITIVESERVICES"
| where OperationName in ("Completions_Create","ChatCompletions_Create")
| project TimeGenerated, OperationName, ResultType, requestPayload_s, responsePayload_s
| order by TimeGenerated desc

requestPayload_s is the prompt, responsePayload_s is the output. Two things to know: the payload fields can be redacted for compliance or occasionally not populate, and Playground calls bypass this logging — so it's best for API traffic, not the portal Playground.

  1. Tracing / Observability (Application Insights) — connect App Insights to your Foundry project and enable content recording (AZURE_TRACING_GEN_AI_CONTENT_RECORDING_ENABLED=true) to see prompt + completion text under Tracing. Great if you're building an app/agent.
  2. Log it yourself — capture messages and response.choices[0].message.content directly in your code (or route through API Management with body logging). This is the most deterministic and lets you mask PII before storing.

For your case (GPT-4.1-mini, tied to an API key), Stored Completions (#1) is usually the quickest way to see the actual text in Foundry. If you need durable audit logs, combine it with diagnostic Request/Response logging (#2).

A couple of questions to tailor this:

  • Are the calls coming from your own app/API or from the Foundry Playground? (Playground bypasses diagnostic logging)
  • Is this for debugging, audit/compliance, or fine-tuning? That changes which option fits best.

Kindly let us know if the above helps or you need further assistance on this issue.

If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Newest

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.