unkey
Unkeyのエキスパートとして、オープンソースのAPIキー管理プラットフォームを活用し、APIキーの作成・検証・管理を支援、レート制限や利用状況の追跡、一時キー、キーローテーション、権限設定などを提供し、API認証基盤構築を不要にするSkill。
📜 元の英語説明(参考)
You are an expert in Unkey, the open-source API key management platform. You help developers create, validate, and manage API keys with built-in rate limiting, usage tracking, temporary keys, key rotation, and per-key permissions — providing the complete API authentication layer for developer platforms, SaaS APIs, and internal services without building custom key infrastructure.
🇯🇵 日本人クリエイター向け解説
Unkeyのエキスパートとして、オープンソースのAPIキー管理プラットフォームを活用し、APIキーの作成・検証・管理を支援、レート制限や利用状況の追跡、一時キー、キーローテーション、権限設定などを提供し、API認証基盤構築を不要にするSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o unkey.zip https://jpskill.com/download/15517.zip && unzip -o unkey.zip && rm unkey.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15517.zip -OutFile "$d\unkey.zip"; Expand-Archive "$d\unkey.zip" -DestinationPath $d -Force; ri "$d\unkey.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
unkey.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
unkeyフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Unkey — APIキー管理
あなたは、オープンソースのAPIキー管理プラットフォームであるUnkeyのエキスパートです。開発者がAPIキーを作成、検証、管理するのを支援し、レート制限、使用状況追跡、一時キー、キーローテーション、キーごとの権限を組み込んで、カスタムキーインフラストラクチャを構築することなく、開発者プラットフォーム、SaaS API、および内部サービス向けの完全なAPI認証レイヤーを提供します。
主要な機能
キー管理
import { Unkey } from "@unkey/api";
const unkey = new Unkey({ rootKey: process.env.UNKEY_ROOT_KEY! });
// 顧客のAPIキーを作成
const { result } = await unkey.keys.create({
apiId: process.env.UNKEY_API_ID!,
prefix: "sk_live", // 識別用のキープレフィックス
name: "Acme Corp Production Key",
ownerId: "customer-42", // ユーザーへのリンク
meta: { // カスタムメタデータ
plan: "pro",
team: "engineering",
},
roles: ["api.read", "api.write"], // RBAC権限
ratelimit: {
type: "fast",
limit: 100, // 100リクエスト
duration: 60000, // 1分あたり
},
remaining: 10000, // 総使用量制限(オプション)
expires: Date.now() + 30 * 24 * 60 * 60 * 1000, // 30日間(オプション)
});
console.log(result.key); // sk_live_abc123... (一度だけ表示!)
console.log(result.keyId); // key_xxx (管理用)
キー検証(API内)
import { verifyKey } from "@unkey/api";
// ミドルウェア — すべてのリクエストでAPIキーを検証
async function authMiddleware(req: Request) {
const key = req.headers.get("Authorization")?.replace("Bearer ", "");
if (!key) return new Response("Missing API key", { status: 401 });
const { result, error } = await verifyKey({
key,
apiId: process.env.UNKEY_API_ID!,
});
if (error || !result.valid) {
return new Response(JSON.stringify({
error: "Invalid API key",
code: result?.code, // "NOT_FOUND" | "RATE_LIMITED" | "USAGE_EXCEEDED" | "EXPIRED"
}), { status: result?.code === "RATE_LIMITED" ? 429 : 403 });
}
// キーは有効 — メタデータにアクセス
const { ownerId, meta, roles, remaining, ratelimit } = result;
console.log(`Customer: ${ownerId}, Plan: ${meta.plan}, Remaining: ${remaining}`);
// 権限を確認
if (!roles.includes("api.write") && req.method !== "GET") {
return new Response("Insufficient permissions", { status: 403 });
}
// レート制限情報をレスポンスヘッダーに含める
return {
ownerId,
meta,
headers: {
"X-RateLimit-Limit": String(ratelimit?.limit),
"X-RateLimit-Remaining": String(ratelimit?.remaining),
"X-RateLimit-Reset": String(ratelimit?.reset),
},
};
}
キーのライフサイクル
// キーを更新(制限、ロールを変更)
await unkey.keys.update({
keyId: "key_xxx",
ratelimit: { type: "fast", limit: 500, duration: 60000 }, // 制限をアップグレード
roles: ["api.read", "api.write", "api.admin"],
meta: { plan: "enterprise" },
});
// キーを失効
await unkey.keys.delete({ keyId: "key_xxx" });
// 顧客のキーをリスト表示
const { result: keys } = await unkey.apis.listKeys({
apiId: process.env.UNKEY_API_ID!,
ownerId: "customer-42",
});
// 使用状況分析
const { result: verifications } = await unkey.keys.getVerifications({
keyId: "key_xxx",
start: Date.now() - 7 * 24 * 60 * 60 * 1000, // 過去7日間
end: Date.now(),
granularity: "day",
});
インストール
npm install @unkey/api
ベストプラクティス
- キーにプレフィックスを付ける —
sk_live_、sk_test_プレフィックスを使用します。キーの種類が一目でわかります。 - レート制限が組み込まれている — 作成時にキーごとのレート制限を設定します。Unkeyは検証時に適用します。
- 使用量制限 — プリペイド/クォータモデルの場合は
remainingを設定します。キーは使い果たすと自動的に無効になります。 - RBACロール — キーにロールを割り当てます。ミドルウェアで確認します。エンドポイントごとにアクセスをスコープします。
- キーローテーション — 新しいキーを作成し、クライアントを更新し、古いキーを失効させます。ダウンタイムなしのローテーション。
- メタデータ — プラン、チーム、環境を
metaに保存します。分析やフィーチャーフラグに使用します。 - 有効期限付きキー — トライアルキー、一時的なアクセスのために
expiresを設定します。cronなしで自動的に期限切れになります。 - セルフホスト可能 — データ主権のために、Unkeyを独自のインフラストラクチャで実行します。オープンソースです。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Unkey — API Key Management
You are an expert in Unkey, the open-source API key management platform. You help developers create, validate, and manage API keys with built-in rate limiting, usage tracking, temporary keys, key rotation, and per-key permissions — providing the complete API authentication layer for developer platforms, SaaS APIs, and internal services without building custom key infrastructure.
Core Capabilities
Key Management
import { Unkey } from "@unkey/api";
const unkey = new Unkey({ rootKey: process.env.UNKEY_ROOT_KEY! });
// Create API key for a customer
const { result } = await unkey.keys.create({
apiId: process.env.UNKEY_API_ID!,
prefix: "sk_live", // Key prefix for identification
name: "Acme Corp Production Key",
ownerId: "customer-42", // Link to your user
meta: { // Custom metadata
plan: "pro",
team: "engineering",
},
roles: ["api.read", "api.write"], // RBAC permissions
ratelimit: {
type: "fast",
limit: 100, // 100 requests
duration: 60000, // Per minute
},
remaining: 10000, // Total usage limit (optional)
expires: Date.now() + 30 * 24 * 60 * 60 * 1000, // 30 days (optional)
});
console.log(result.key); // sk_live_abc123... (show once!)
console.log(result.keyId); // key_xxx (for management)
Key Verification (in your API)
import { verifyKey } from "@unkey/api";
// Middleware — verify API key on every request
async function authMiddleware(req: Request) {
const key = req.headers.get("Authorization")?.replace("Bearer ", "");
if (!key) return new Response("Missing API key", { status: 401 });
const { result, error } = await verifyKey({
key,
apiId: process.env.UNKEY_API_ID!,
});
if (error || !result.valid) {
return new Response(JSON.stringify({
error: "Invalid API key",
code: result?.code, // "NOT_FOUND" | "RATE_LIMITED" | "USAGE_EXCEEDED" | "EXPIRED"
}), { status: result?.code === "RATE_LIMITED" ? 429 : 403 });
}
// Key is valid — access metadata
const { ownerId, meta, roles, remaining, ratelimit } = result;
console.log(`Customer: ${ownerId}, Plan: ${meta.plan}, Remaining: ${remaining}`);
// Check permissions
if (!roles.includes("api.write") && req.method !== "GET") {
return new Response("Insufficient permissions", { status: 403 });
}
// Rate limit info in response headers
return {
ownerId,
meta,
headers: {
"X-RateLimit-Limit": String(ratelimit?.limit),
"X-RateLimit-Remaining": String(ratelimit?.remaining),
"X-RateLimit-Reset": String(ratelimit?.reset),
},
};
}
Key Lifecycle
// Update key (change limits, roles)
await unkey.keys.update({
keyId: "key_xxx",
ratelimit: { type: "fast", limit: 500, duration: 60000 }, // Upgrade limit
roles: ["api.read", "api.write", "api.admin"],
meta: { plan: "enterprise" },
});
// Revoke key
await unkey.keys.delete({ keyId: "key_xxx" });
// List keys for a customer
const { result: keys } = await unkey.apis.listKeys({
apiId: process.env.UNKEY_API_ID!,
ownerId: "customer-42",
});
// Usage analytics
const { result: verifications } = await unkey.keys.getVerifications({
keyId: "key_xxx",
start: Date.now() - 7 * 24 * 60 * 60 * 1000, // Last 7 days
end: Date.now(),
granularity: "day",
});
Installation
npm install @unkey/api
Best Practices
- Prefix keys — Use
sk_live_,sk_test_prefixes; identifies key type at a glance - Rate limiting built-in — Set per-key rate limits at creation; Unkey enforces at verify time
- Usage limits — Set
remainingfor prepaid/quota models; key auto-invalidates when exhausted - RBAC roles — Assign roles to keys; check in your middleware; scope access per endpoint
- Key rotation — Create new key, update client, revoke old; zero-downtime rotation
- Metadata — Store plan, team, environment in
meta; use for analytics and feature flags - Expiring keys — Set
expiresfor trial keys, temporary access; auto-expire without cron - Self-hostable — Run Unkey on your own infrastructure for data sovereignty; open-source