jpskill.com
🛠️ 開発・MCP コミュニティ

firebase-ai-logic

Official skill for integrating Firebase AI Logic (Gemini API) into web applications. Covers setup, multimodal inference, structured output, and security.

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して firebase-ai-logic.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → firebase-ai-logic フォルダができる
  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
同梱ファイル
2

📖 Skill本文(日本語訳)

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

Firebase AI Logic の基本

概要

Firebase AI Logic は、開発者がクライアントサイド SDK を使用して、モバイルアプリやウェブアプリに生成 AI を追加できるようにする Firebase の製品です。専用のバックエンドを管理することなく、アプリから直接 Gemini モデルを呼び出すことができます。以前は「Vertex AI for Firebase」として知られていた Firebase AI Logic は、モバイルおよびウェブ開発者向けの Google の AI 統合プラットフォームの進化を表しています。

以下の 2 つの Gemini API プロバイダをサポートしています。

  • Gemini Developer API: プロトタイプ作成に最適な無料枠と、本番環境向けの従量課金制があります。
  • Vertex AI Gemini API: エンタープライズグレードの本番環境対応で大規模な利用に最適です。Blaze プランが必要です。

デフォルトでは Gemini Developer API を使用し、アプリケーションで必要とされる場合にのみ Vertex AI Gemini API を使用してください。

セットアップと初期化

前提条件

  • 開始する前に、Node.js 16+ と npm がインストールされていることを確認してください。まだ利用できない場合はインストールしてください。
  • 開始する前に、ユーザーが構築に関心のあるプラットフォーム(Android、iOS、Flutter、Web)を特定してください。
  • サポートされていないプラットフォームの場合、ユーザーに Firebase ドキュメントを参照して、アプリケーションに AI Logic をセットアップする方法を学んでもらってください(このリンクをユーザーと共有してください: https://firebase.google.com/docs/ai-logic/get-started)。

インストール

このライブラリは標準の Firebase Web SDK の一部です。

npm install -g firebase@latest

Firebase ディレクトリ(firebase.json がある場合)にいる場合、このコマンドを使用すると、現在選択されているプロジェクトが「current」とマークされます。

npx -y firebase-tools@latest projects:list

現在のプロジェクトに少なくとも 1 つのアプリが関連付けられていることを確認してください。

npx -y firebase-tools@latest apps:list

init コマンドで AI Logic SDK を初期化します。

npx -y firebase-tools@latest init # Choose AI logic

これにより、Firebase コンソールで Gemini Developer API が自動的に有効になります。

詳細については、Firebase AI Logic の使用開始 を参照してください。

主要な機能

テキストのみの生成

マルチモーダル(テキスト + 画像/音声/動画/PDF 入力)

Firebase AI Logic を使用すると、Gemini モデルがアプリから直接画像ファイルを分析できます。これにより、キャプションの作成、画像に関する質問への回答、オブジェクトの検出、画像の分類などの機能が可能になります。画像以外にも、Gemini は音声、動画、PDF などの他のメディアタイプを、MIME タイプとともにインラインデータとして渡すことで分析できます。20 メガバイトを超えるファイル(インラインデータとして HTTP 413 エラーを引き起こす可能性があります)の場合、それらを Cloud Storage for Firebase に保存し、その URL を Gemini Developer API に渡してください。

チャットセッション(複数ターン)

startChat を使用して履歴を自動的に保持します。

ストリーミング応答

部分的な結果が到着するにつれて(タイピング効果のように)表示することでユーザーエクスペリエンスを向上させるには、generateContent の代わりに generateContentStream を使用して、結果をより速く表示してください。

Nano Banana で画像を生成

  • ほとんどのユースケースでは Gemini から始め、画質と特定のスタイルが重要な特殊なタスクでは Imagen を選択してください。(例: gemini-2.5-flash-image)
  • アップグレードされた Blaze 従量課金制プランが必要です。

組み込みの googleSearch ツールによる検索グラウンディング

サポートされているプラットフォームとフレームワーク

サポートされているプラットフォームとフレームワークには、Android 用の Kotlin と Java、iOS 用の Swift、ウェブアプリ用の JavaScript、Flutter 用の Dart、Unity 用の C Sharp が含まれます。

高度な機能

構造化出力(JSON)

応答に特定の JSON スキーマを強制します。

オンデバイス AI(ハイブリッド)

ウェブアプリ向けのハイブリッドオンデバイス推論では、Firebase Javascript SDK が Gemini Nano の利用可能性を自動的にチェックし(インストール後)、オンデバイスまたはクラウドホストのプロンプト実行を切り替えます。これには、Chrome ブラウザでモデルの使用を有効にするための特定の手順が必要です。詳細については、ハイブリッドオンデバイス推論のドキュメント を参照してください。

セキュリティと本番環境

App Check

推奨: 開発者は、不正なクライアントが API クォータを使用するのを防ぐために、Firebase App Check を有効にする必要があります。App Check reCAPTCHA Enterprise を参照してください。

Remote Config

モデル名(例: gemini-flash-lite-latest)をハードコードする必要がないことを考慮してください。Firebase Remote Config を使用して、新しいクライアントコードをデプロイすることなく、モデルバージョンを動的に更新してください。モデル名をリモートで変更する を参照してください。

初期化コードの参照

言語、フレームワーク、プラットフォーム Gemini API プロバイダ コンテキスト URL
Web Modular API Gemini Developer API (Developer API) firebase://docs/ai-logic/get-started

ドキュメントまたはユーザーから別のモデルが要求されない限り、常に最新バージョンの Gemini(gemini-flash-latest)を使用してください。gemini-1.5-flash は使用しないでください。

参照

Web SDK コード例と使用パターン

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Firebase AI Logic Basics

Overview

Firebase AI Logic is a product of Firebase that allows developers to add gen AI to their mobile and web apps using client-side SDKs. You can call Gemini models directly from your app without managing a dedicated backend. Firebase AI Logic, which was previously known as "Vertex AI for Firebase", represents the evolution of Google's AI integration platform for mobile and web developers.

It supports the two Gemini API providers:

  • Gemini Developer API: It has a free tier ideal for prototyping, and pay-as-you-go for production
  • Vertex AI Gemini API: Ideal for scale with enterprise-grade production readiness, requires Blaze plan

Use the Gemini Developer API as a default, and only Vertex AI Gemini API if the application requires it.

Setup & Initialization

Prerequisites

  • Before starting, ensure you have Node.js 16+ and npm installed. Install them if they aren’t already available.
  • Identify the platform the user is interested in building on prior to starting: Android, iOS, Flutter or Web.
  • If their platform is unsupported, Direct the user to Firebase Docs to learn how to set up AI Logic for their application (share this link with the user https://firebase.google.com/docs/ai-logic/get-started)

Installation

The library is part of the standard Firebase Web SDK.

npm install -g firebase@latest

If you're in a firebase directory (with a firebase.json) the currently selected project will be marked with "current" using this command:

npx -y firebase-tools@latest projects:list

Ensure there's at least one app associated with the current project

npx -y firebase-tools@latest apps:list

Initialize AI logic SDK with the init command

npx -y firebase-tools@latest init # Choose AI logic

This will automatically enable the Gemini Developer API in the Firebase console.

More info in Firebase AI Logic Getting Started

Core Capabilities

Text-Only Generation

Multimodal (Text + Images/Audio/Video/PDF input)

Firebase AI Logic allows Gemini models to analyze image files directly from your app. This enables features like creating captions, answering questions about images, detecting objects, and categorizing images. Beyond images, Gemini can analyze other media types like audio, video, and PDFs by passing them as inline data with their MIME type. For files larger than 20 megabytes (which can cause HTTP 413 errors as inline data), store them in Cloud Storage for Firebase and pass their URLs to the Gemini Developer API.

Chat Session (Multi-turn)

Maintain history automatically using startChat.

Streaming Responses

To improve the user experience by showing partial results as they arrive (like a typing effect), use generateContentStream instead of generateContent for faster display of results.

Generate Images with Nano Banana

  • Start with Gemini for most use cases, and choose Imagen for specialized tasks where image quality and specific styles are critical. (Example: gemini-2.5-flash-image)
  • Requires an upgraded Blaze pay-as-you-go billing plan.

Search Grounding with the built in googleSearch tool

Supported Platforms and Frameworks

Supported Platforms and Frameworks include Kotlin and Java for Android, Swift for iOS, JavaScript for web apps, Dart for Flutter, and C Sharp for Unity.

Advanced Features

Structured Output (JSON)

Enforce a specific JSON schema for the response.

On-Device AI (Hybrid)

Hybrid on-device inference for web apps, where the Firebase Javascript SDK automatically checks for Gemini Nano's availability (after installation) and switches between on-device or cloud-hosted prompt execution. This requires specific steps to enable model usage in the Chrome browser, more info in the hybrid-on-device-inference documentation.

Security & Production

App Check

Recommended: The developer must enable Firebase App Check to prevent unauthorized clients from using their API quota. see App-check recaptcha enterprise.

Remote Config

Consider that you do not need to hardcode model names (e.g., gemini-flash-lite-latest). Use Firebase Remote Config to update model versions dynamically without deploying new client code. See Changing model names remotely

Initialization Code References

Language, Framework, Platform Gemini API provider Context URL
Web Modular API Gemini Developer API (Developer API) firebase://docs/ai-logic/get-started

Always use the most recent version of Gemini (gemini-flash-latest) unless another model is requested by the docs or the user. DO NOT USE gemini-1.5-flash

References

Web SDK code examples and usage patterns

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。