Skip to main content Accueil Créateurs biwakonbu cc-plugins workers-ai
workers-ai Use when user asks about Workers AI, AI models, Vectorize, AI Gateway, LLM, image generation, speech recognition, embeddings, or RAG. Also use when user says Workers AI, AI モデル, ベクトル検索, 埋め込み, RAG. Cloudflare Workers AI の完全ガイドで、利用可能モデル(LLM、画像、音声、埋め込み)、Vectorize、AI Gateway の使い方と設定を提供する。
Aller à l'installation Skills Marketplace Découvrez et explorez les compétences IA créées par la communauté.
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Copier le promptAfficher les détails du prompt Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
npx skills add https://github.com/biwakonbu/cc-plugins --skill workers-aiLa commande reste sur une seule ligne. Faites défiler horizontalement pour la vérifier avant de la copier.
Vous préférez une copie locale ? Téléchargez les fichiers actuellement disponibles dans SkillsMP.
Télécharger Zip Téléchargement... Use when user asks about Claude Code, plugins, skills, slash commands, subagents, hooks, LSP, MCP, permissions, sessions, plan mode, agent teams, background agents, worktree, teleport, effort, structured output, --bare, or --console. Also use when user says Claude Code について, プラグイン開発, スキル定義, フック設定, 権限設定. Claude Code CLI の仕様と使い方に関する知識を提供し、プラグイン開発、スキル、スラッシュコマンド、サブエージェント、フック、LSP、MCP、権限設定、セッション管理、エージェントチーム、バックグラウンドエージェント、Git Worktree、セッションテレポート、effort 制御、構造化出力、リモートセッションについて回答する。
Métiers associés SOC
Basé sur la classification professionnelle SOC
name workers-ai description Use when user asks about Workers AI, AI models, Vectorize, AI Gateway, LLM, image generation, speech recognition, embeddings, or RAG. Also use when user says Workers AI, AI モデル, ベクトル検索, 埋め込み, RAG. Cloudflare Workers AI の完全ガイドで、利用可能モデル(LLM、画像、音声、埋め込み)、Vectorize、AI Gateway の使い方と設定を提供する。 context fork
Cloudflare Workers AI
概要
Workers AI は Cloudflare エッジネットワーク上でサーバーレス AI 推論を提供。
LLM、画像生成、音声認識、埋め込みなど多様なモデルをサポート。
設定
[ai]
binding = "AI"
基本的な使い方
export default {
async fetch (request : Request , env : Env ) {
const response = await env.AI .run (
"@cf/meta/llama-3.1-8b-instruct" ,
{
messages : [
{ role : "system" , content : "You are a helpful assistant." },
{ : , : },
],
}
);
. (response);
},
};
role
"user"
content
"Hello!"
return
Response
json
利用可能モデル
LLM(大規模言語モデル) モデル パラメータ 特徴 @cf/meta/llama-4-scout-17b-16e-instruct17B マルチモーダル、MoE @cf/meta/llama-3.3-70b-instruct-fp8-fast70B 高性能 @cf/meta/llama-3.2-11b-vision-instruct11B 画像認識 @cf/meta/llama-3.2-3b-instruct3B 軽量 @cf/meta/llama-3.1-8b-instruct8B バランス型 @cf/mistral/mistral-small-3.1-24b-instruct24B 128K コンテキスト @hf/nousresearch/hermes-2-pro-mistral-7b7B Function Calling
画像生成 モデル 特徴 @cf/stabilityai/stable-diffusion-xl-base-1.0SDXL 基本 @cf/bytedance/stable-diffusion-xl-lightning高速生成 @cf/lykon/dreamshaper-8-lcm高品質
音声認識 モデル 特徴 @cf/openai/whisper-large-v3-turbo高精度、多言語 @cf/openai/whisper標準
埋め込み モデル 次元数 特徴 @cf/baai/bge-base-en-v1.5768 英語特化 @cf/baai/bge-m31024 100言語対応 @cf/baai/bge-small-en-v1.5384 軽量
テキスト分類・翻訳 モデル 用途 @cf/huggingface/distilbert-sst-2-int8感情分析 @cf/meta/m2m100-1.2b多言語翻訳
LLM 使用例
基本的なチャット const response = await env.AI .run ("@cf/meta/llama-3.1-8b-instruct" , {
messages : [
{ role : "system" , content : "あなたは親切なアシスタントです。" },
{ role : "user" , content : "東京の天気を教えて" },
],
max_tokens : 256 ,
temperature : 0.7 ,
});
console .log (response.response );
ストリーミング const stream = await env.AI .run ("@cf/meta/llama-3.1-8b-instruct" , {
messages : [{ role : "user" , content : "長い物語を書いて" }],
stream : true ,
});
return new Response (stream, {
headers : { "Content-Type" : "text/event-stream" },
});
Function Calling const response = await env.AI .run (
"@hf/nousresearch/hermes-2-pro-mistral-7b" ,
{
messages : [{ role : "user" , content : "東京の天気は?" }],
tools : [
{
type : "function" ,
function : {
name : "get_weather" ,
description : "指定した場所の天気を取得" ,
parameters : {
type : "object" ,
properties : {
location : { type : "string" , description : "場所" },
},
required : ["location" ],
},
},
},
],
}
);
画像生成 const response = await env.AI .run (
"@cf/stabilityai/stable-diffusion-xl-base-1.0" ,
{
prompt : "A beautiful sunset over mountains, high quality, 4k" ,
negative_prompt : "blurry, low quality" ,
num_steps : 20 ,
guidance : 7.5 ,
}
);
return new Response (response, {
headers : { "Content-Type" : "image/png" },
});
音声認識 const audioData = await request.arrayBuffer ();
const response = await env.AI .run (
"@cf/openai/whisper-large-v3-turbo" ,
{
audio : [...new Uint8Array (audioData)],
}
);
return Response .json ({
text : response.text ,
language : response.detected_language ,
});
埋め込み const response = await env.AI .run ("@cf/baai/bge-base-en-v1.5" , {
text : ["Hello, world!" , "How are you?" ],
});
Vectorize
概要 エッジで動作する分散型ベクトルデータベース。RAG アプリケーション構築に最適。
インデックス作成
wrangler vectorize create my-index \
--preset @cf/baai/bge-small-en-v1.5
wrangler vectorize create my-index \
--dimensions 768 \
--metric cosine
設定
[[vectorize]]
binding = "VECTORIZE"
index_name = "my-index"
ベクトル操作
await env.VECTORIZE .upsert ([
{
id : "doc-1" ,
values : embedding,
metadata : { title : "Document 1" , category : "tech" },
},
]);
const results = await env.VECTORIZE .query (queryVector, {
topK : 5 ,
filter : { category : "tech" },
returnMetadata : "all" ,
});
await env.VECTORIZE .deleteByIds (["doc-1" , "doc-2" ]);
RAG パターン export default {
async fetch (request : Request , env : Env ) {
const { query } = await request.json ();
const embedResponse = await env.AI .run ("@cf/baai/bge-base-en-v1.5" , {
text : [query],
});
const queryVector = embedResponse.data [0 ].embedding ;
const results = await env.VECTORIZE .query (queryVector, {
topK : 3 ,
returnMetadata : "all" ,
});
const context = results.matches
.map ((m ) => m.metadata ?.content )
.join ("\n\n" );
const response = await env.AI .run ("@cf/meta/llama-3.1-8b-instruct" , {
messages : [
{
role : "system" ,
content : `以下のコンテキストに基づいて回答してください:\n\n${context} ` ,
},
{ role : "user" , content : query },
],
});
return Response .json ({ answer : response.response });
},
};
AI Gateway
概要 複数の AI プロバイダー(OpenAI、Anthropic、Google など)を統合管理。
ログ、キャッシュ、レート制限、フォールバックを提供。
対応プロバイダー
OpenAI
Anthropic
Google AI
Groq
DeepSeek
Workers AI
その他16以上
設定 ダッシュボードで AI Gateway を作成し、エンドポイントを取得。
使用例
const response = await fetch (
"https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/openai/chat/completions" ,
{
method : "POST" ,
headers : {
"Content-Type" : "application/json" ,
"Authorization" : `Bearer ${env.OPENAI_KEY} ` ,
},
body : JSON .stringify ({
model : "gpt-4" ,
messages : [{ role : "user" , content : "Hello" }],
}),
}
);
機能 機能 説明 ログ リクエスト/レスポンスを記録 キャッシュ 同一リクエストのキャッシュ レート制限 リクエスト数制限 フォールバック プロバイダー障害時の自動切り替え DLP 機密データ検出(ベータ)
料金体系
Workers AI 項目 無料枠 有料 ニューロン 10,000/日 $0.011/1,000ニューロン
LLM: 入力トークン数 × 係数
画像生成: 約10,000ニューロン/画像
埋め込み: 少量
Vectorize 項目 無料枠 有料 クエリ 30M/月 $0.01/1M クエリ ストレージ 5M ベクトル次元 $0.05/1M 次元月
REST API curl https://api.cloudflare.com/client/v4/accounts/{account_id}/ai/run/@cf/meta/llama-3.1-8b-instruct \
-X POST \
-H "Authorization: Bearer {API_TOKEN}" \
-d '{
"messages": [
{"role": "user", "content": "Hello"}
]
}'
ベストプラクティス
モデル選択 用途 推奨モデル 一般的なチャット llama-3.1-8b-instruct高精度な回答 llama-3.3-70b-instruct-fp8-fast画像理解 llama-3.2-11b-vision-instruct軽量・高速 llama-3.2-3b-instructFunction Calling hermes-2-pro-mistral-7b
パフォーマンス最適化
const cacheKey = `ai:${hash(prompt)} ` ;
let response = await env.KV .get (cacheKey, "json" );
if (!response) {
response = await env.AI .run ("@cf/meta/llama-3.1-8b-instruct" , {
messages : [{ role : "user" , content : prompt }],
});
await env.KV .put (cacheKey, JSON .stringify (response), {
expirationTtl : 3600 ,
});
}
公式リソース