portkey-typescript-sdk

Integrate Portkey AI Gateway into TypeScript and JavaScript applications for LLM routing.

10|1|Updated Nov 18, 2025
One-click install
npx skills add https://github.com/martinrojas/ai-scratchpad --skill portkey-typescript-sdk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: portkey-typescript-sdk
Source: https://github.com/martinrojas/ai-scratchpad/tree/main/tools/claude-code/skills/portkey-typescript-sdk
Command: npx skills add https://github.com/martinrojas/ai-scratchpad --skill portkey-typescript-sdk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

Integrate Portkey into TypeScript and JavaScript applications to provide production-grade observability, caching, provider routing, and reliability for LLM requests so teams don't have to build gateway features from scratch.

Core Features & Use Cases

  • Observability & Tracing: Capture request/response telemetry and traces across multiple LLM providers for debugging and SLA monitoring.
  • Caching & Fallbacks: Reduce latency and cost with caching layers and automated fallback strategies when providers fail or hit rate limits.
  • Provider Routing & Load Balancing: Route requests across hundreds of LLM providers using virtual keys, weight-based policies, and failover rules.
  • Use Case: A backend chat service can use the SDK to route completions to preferred models, cache embeddings for fast retrieval, and automatically fail over to backup providers during outages.

Quick Start

Create a Portkey client with your API key and virtual key, then send a test chat completion to verify routing, caching, and observability.

Frequently Asked Questions about portkey-typescript-sdk

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

FAQPage Schema
How do I add LLM provider routing and failover to a Node.js backend?

Integrating an AI gateway SDK into your Node.js backend enables LLM provider routing and failover by managing virtual keys, weight-based load balancing, and automated fallbacks across hundreds of providers.

What is the best way to cache LLM completions in TypeScript serverless applications?

The best way to cache LLM completions in TypeScript serverless applications is using a gateway SDK that applies caching layers to requests, reducing latency and operational costs for embeddings and chat completions.

Does this AI gateway observability tool work with bun and pnpm?

Yes, this AI gateway observability tool is compatible with bun and pnpm, alongside standard npm and yarn package managers, fully supporting Node.js 18+ backend and serverless TypeScript projects.

How do I trace LLM request telemetry for debugging SLA monitoring?

You trace LLM request telemetry for debugging SLA monitoring by routing traffic through a gateway that automatically captures request and response telemetry, providing detailed traces across multiple LLM providers.

Can I use virtual keys to load balance requests across multiple LLM providers?

You can use virtual keys to load balance requests across multiple LLM providers by configuring a gateway client that applies weight-based routing policies and failover rules for your chat completions.

What are the limitations of building custom LLM gateway reliability in TypeScript?

Building custom LLM gateway reliability in TypeScript requires your team to manually engineer observability, caching, and provider failover from scratch, whereas an SDK provides these production-grade features out of the box.