truefoundry-ai-monitoring

Query AI Gateway spans API for traces, costs, latency, errors, and token usage.

13|Updated Feb 13, 2026
One-click install
npx skills add https://github.com/truefoundry/tfy-gateway-skills --skill truefoundry-ai-monitoring
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: truefoundry-ai-monitoring
Source: https://github.com/truefoundry/tfy-gateway-skills/tree/main/skills/ai-monitoring
Command: npx skills add https://github.com/truefoundry/tfy-gateway-skills --skill truefoundry-ai-monitoring

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires curl, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Monitors AI Gateway traces and usage metrics by querying the spans API to help you understand traffic, costs, latency, and errors across your gateway.

Core Features & Use Cases

  • Query AI Gateway request traces via the spans query API to surface recent requests, latency breakdowns, and model usage.
  • Compute cost and token usage per trace, per model, and per data routing destination for cost governance.
  • Detect errors and performance regressions with status filtering and per-user or per-application breakdowns.
  • Use cases include debugging gateway performance, optimizing prompts routing, and auditing token spend for MCP tool calls.

Quick Start

Ask the agent to fetch the most recent gateway traces using the spans query API after confirming TFY_BASE_URL and TFY_API_KEY are set.

Frequently Asked Questions about truefoundry-ai-monitoring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I monitor AI gateway latency and token usage for recent requests?

You can monitor AI gateway latency and token usage by querying the spans API to surface recent request traces, latency breakdowns, and model usage. This approach helps investigate gateway traffic and performance regressions over recent time windows.

What is the best way to analyze token costs per model in an AI gateway?

Analyzing token costs per model requires querying gateway spans to compute cost and token usage per trace, per model, and per data routing destination. This enables effective cost governance and auditing of token spend for tool calls.

Do I need specific environment variables set to query gateway traces?

Yes, querying gateway traces requires TFY_BASE_URL and TFY_API_KEY environment variables to be set. The monitoring process enforces credential checks before returning structured results suitable for tabular presentation with pagination.

Can I detect errors and performance regressions in gateway traffic using spans?

Yes, you can detect errors and performance regressions in gateway traffic by applying status filtering to spans queries. This allows per-user or per-application breakdowns to isolate issues within recent time windows.

Does AI gateway monitoring work with curl for fetching trace data?

Yes, AI gateway monitoring works with curl as a dependency to query the spans API. It fetches structured results covering request traces, errors, and token usage suitable for tabular presentation.