• LATENCY
  • ERRORS
  • PAYLOADS
  • HUMAN

How to debug LLM latency and errors with your AI

Connect Portkey to your agent to pull live gateway logs. You can then pinpoint exactly where requests are stalling or failing.

Ask AI about this page

Short answer

How can I find out why my AI calls are slow or failing?

Your agent uses Portkey gateway logs to identify high-latency requests and specific error codes. It can pull a list of recent logs or dive into the full details of a single failed call to show you the exact payload and response. You'll see exactly what went wrong without leaving your chat.

Debugging outcomes

Where your debugging data lands.

The AI organizes log data into actionable categories.

LATENCY

Identify slow calls

The AI scans recent logs to find requests that exceeded your expected response time. You get a list of the specific endpoints causing the lag.

ERRORS

Pinpoint request failures

The AI pulls the exact error messages and status codes for failed calls. This helps you see if the issue is a model timeout or a malformed prompt.

PAYLOADS

Inspect request details

The AI retrieves the full body of a specific log entry. You can check the exact input sent to the model and the raw output it returned.

HUMAN

Manual intervention

The AI identifies patterns in failures but cannot fix your code or change your model settings. You'll need to apply the fixes in your application directly.

The workflow

What your AI does when a request fails.

The agent acts as a bridge between your chat and the Portkey gateway.

  1. Scan recent activity

    The agent looks through the most recent gateway traffic to find problematic entries.

    list_logs
  2. Isolate the issue

    Once a slow or failed call is found, the agent pulls the specific data for that event.

    get_log_details
  3. Analyze the error

    The agent reads the error message and the request payload to explain why the call failed.

    get_log_details
  4. Summarize findings

    The agent presents a clear explanation of the latency or error pattern to you.

    list_logs

Try it

Copy these to start.

Use these prompts to begin debugging immediately.

Starting points

Swap out the specific error types or timeframes to get more targeted results.

Portkey Connector

You're all set. Choose your MCP client and follow the setup instructions.

Connector linkhttps://edge.vinkius.com/vk_preview_BpHtQMK896fkGyepmah9cM552NpibU6fUP5BakNG/mcp

Claude Desktop

Follow the steps below to connect in seconds.

  1. 1In Claude Desktop, open Settings → Connectors.
  2. 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
  3. 3Click Add and start a new chat — Portkey capabilities are ready to use.
Configuration · claude_desktop_config.jsonCopy
{
  "mcpServers": {
    "portkey-mcp": {
      "url": "https://edge.vinkius.com/vk_preview_BpHtQMK896fkGyepmah9cM552NpibU6fUP5BakNG/mcp"
    }
  }
}
Copy into chat04
  • Show me the last 10 logs from Portkey to see if there are any recent errors.

  • Find the most recent request that took longer than 5 seconds to complete.

  • Get the details for the failed request from the last five minutes.

  • List all logs that returned a 500 error code.

  • Claude
  • ChatGPT
  • Cursor
  • VS Code
  • Windsurf
  • Claude Code
  • JetBrains
  • Cline

Start here

Connect Portkey once, then ask.

Just provide your Portkey API key. Your credentials stay encrypted, and you can start debugging through your agent right away.

Connect Portkey to your AI

FAQ

How the Portkey connector behaves

  • 01

    Can the AI fix the errors in my code?

    No. The AI can only read the logs and explain what happened. You have to make the actual code changes in your own environment.

  • 02

    Can the AI delete logs from Portkey?

    No. The tools only allow the AI to read and list logs. It cannot modify or delete any data in your Portkey account.

  • 03

    How recent is the log data?

    The AI sees whatever is currently available in your Portkey gateway logs via the list_logs tool.

  • 04

    Can I see the exact prompt I sent to the model?

    Yes. By using the get_log_details tool, the AI can retrieve the full request body, including your prompts.

  • 05

    Does this work with any AI client?

    Yes, as long as you are using an MCP-compatible client like Claude, Cursor, or Windsurf.

  • More questions about Portkey? See everything the Portkey Connector can do

Connect Portkey to Claude, Cursor, ChatGPT & more