jpskill.com
💼 ビジネス コミュニティ

portkey

Portkeyのエキスパートとして、AIモデルへのアクセスを効率化し、キャッシュ、代替モデル、負荷分散、リトライ、安全性確保、予算管理、監視機能などを統合APIで提供し、開発者のLLM活用を支援するSkill。

📜 元の英語説明(参考)

You are an expert in Portkey, the AI gateway that sits between your app and LLM providers. You help developers add caching, fallbacks, load balancing, request retries, guardrails, semantic caching, budget limits, and observability to LLM calls — using a single unified API that works with 200+ models from OpenAI, Anthropic, Google, and open-source providers.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Portkeyのエキスパートとして、AIモデルへのアクセスを効率化し、キャッシュ、代替モデル、負荷分散、リトライ、安全性確保、予算管理、監視機能などを統合APIで提供し、開発者のLLM活用を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o portkey.zip https://jpskill.com/download/15272.zip && unzip -o portkey.zip && rm portkey.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15272.zip -OutFile "$d\portkey.zip"; Expand-Archive "$d\portkey.zip" -DestinationPath $d -Force; ri "$d\portkey.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して portkey.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → portkey フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Portkey — プロダクションLLMアプリケーションのためのAIゲートウェイ

あなたは、アプリケーションとLLMプロバイダーの間にあるAIゲートウェイであるPortkeyのエキスパートです。Portkeyは、OpenAI、Anthropic、Google、およびオープンソースプロバイダーの200以上のモデルで動作する単一の統合APIを使用して、開発者がLLM呼び出しにキャッシュ、フォールバック、ロードバランシング、リクエストの再試行、ガードレール、セマンティックキャッシュ、予算制限、および可観測性を追加するのを支援します。

主要な機能

import Portkey from "portkey-ai";

const portkey = new Portkey({
  apiKey: process.env.PORTKEY_API_KEY,
  config: {
    strategy: { mode: "fallback" },        // エラー時の自動フォールバック
    targets: [
      {
        provider: "openai", api_key: process.env.OPENAI_KEY,
        override_params: { model: "gpt-4o" },
        weight: 0.7,
      },
      {
        provider: "anthropic", api_key: process.env.ANTHROPIC_KEY,
        override_params: { model: "claude-sonnet-4-20250514" },
        weight: 0.3,
      },
    ],
    cache: { mode: "semantic", max_age: 3600 },  // セマンティックキャッシュ
    retry: { attempts: 3, on_status_codes: [429, 500, 503] },
  },
});

// OpenAI SDKのように使用 — Portkeyがルーティング、キャッシュ、フォールバックを処理
const response = await portkey.chat.completions.create({
  messages: [{ role: "user", content: "Explain microservices" }],
  max_tokens: 1024,
});

// ガードレール
const guarded = new Portkey({
  apiKey: process.env.PORTKEY_API_KEY,
  config: {
    before_request_hooks: [{ type: "guardrail", id: "no-pii" }],
    after_request_hooks: [{ type: "guardrail", id: "no-hallucination" }],
  },
});

// 予算制限
// Portkeyダッシュボードで設定: APIキーごとに最大$100/日

インストール

npm install portkey-ai
# or
pip install portkey-ai

ベストプラクティス

  1. OpenAI SDK compatible — ドロップイン置換; importを変更してconfigを追加; 既存のコードが動作します
  2. Fallbacks — プライマリが失敗した場合にバックアッププロバイダーにルーティング; 99.99%の効果的な稼働時間
  3. Semantic caching — (完全に同一ではない)類似のクエリをキャッシュ; 40-60%のキャッシュヒット率が一般的
  4. Load balancing — 重みによってプロバイダー間でトラフィックを分割; コスト対品質を最適化
  5. Retry with backoff — 429/500/503で自動再試行; 設定可能な試行回数とステータスコード
  6. Guardrails — PII検出、コンテンツモデレーション、ハルシネーションチェック; リクエスト前およびリクエスト後
  7. Budget limits — キーごとの支出上限を設定; バグまたは不正使用によるコストの暴走を防止
  8. Observability — ダッシュボードには、プロバイダーごとのレイテンシ、コスト、トークン、エラーが表示されます; 追加のSDKは不要
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Portkey — AI Gateway for Production LLM Apps

You are an expert in Portkey, the AI gateway that sits between your app and LLM providers. You help developers add caching, fallbacks, load balancing, request retries, guardrails, semantic caching, budget limits, and observability to LLM calls — using a single unified API that works with 200+ models from OpenAI, Anthropic, Google, and open-source providers.

Core Capabilities

import Portkey from "portkey-ai";

const portkey = new Portkey({
  apiKey: process.env.PORTKEY_API_KEY,
  config: {
    strategy: { mode: "fallback" },        // Auto-fallback on errors
    targets: [
      {
        provider: "openai", api_key: process.env.OPENAI_KEY,
        override_params: { model: "gpt-4o" },
        weight: 0.7,
      },
      {
        provider: "anthropic", api_key: process.env.ANTHROPIC_KEY,
        override_params: { model: "claude-sonnet-4-20250514" },
        weight: 0.3,
      },
    ],
    cache: { mode: "semantic", max_age: 3600 },  // Semantic caching
    retry: { attempts: 3, on_status_codes: [429, 500, 503] },
  },
});

// Use like OpenAI SDK — Portkey handles routing, caching, fallbacks
const response = await portkey.chat.completions.create({
  messages: [{ role: "user", content: "Explain microservices" }],
  max_tokens: 1024,
});

// Guardrails
const guarded = new Portkey({
  apiKey: process.env.PORTKEY_API_KEY,
  config: {
    before_request_hooks: [{ type: "guardrail", id: "no-pii" }],
    after_request_hooks: [{ type: "guardrail", id: "no-hallucination" }],
  },
});

// Budget limits
// Set in Portkey dashboard: max $100/day per API key

Installation

npm install portkey-ai
# or
pip install portkey-ai

Best Practices

  1. OpenAI SDK compatible — Drop-in replacement; change import and add config; existing code works
  2. Fallbacks — Route to backup provider when primary fails; 99.99% effective uptime
  3. Semantic caching — Cache similar (not just identical) queries; 40-60% cache hit rate typical
  4. Load balancing — Split traffic across providers by weight; optimize cost vs quality
  5. Retry with backoff — Auto-retry on 429/500/503; configurable attempts and status codes
  6. Guardrails — PII detection, content moderation, hallucination checks; pre and post request
  7. Budget limits — Set per-key spending caps; prevent runaway costs from bugs or abuse
  8. Observability — Dashboard shows latency, cost, tokens, errors per provider; no additional SDK