Gemini API を使用してアプリを構築する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
App Prototyping agent を使用して Gemini API で新しいアプリのプロトタイプを自動的に作成できますが、ボタンを 1 回クリックするだけで Gemini Developer API で空白のキャンバスを起動することもできます。必要なすべての Gemini API インフラストラクチャを含むテンプレートを使用して、アプリで Google の最新の生成 AI モデルの使用を開始します。Gemini API キーを追加するだけで、コーディングを開始できます。
Gemini API がプリロードされた新しいアプリを構築する
テンプレート ダッシュボードから Firebase Studio Gemini API テンプレートにアクセスし、AI の力を利用して構築します。
- Firebase Studio テンプレート ダッシュボードから Gemini API 用の Firebase Studio テンプレート を開きます。
- 環境の言語とフレームワークを選択します。Firebase Studio の Gemini API テンプレートは、JavaScript(Vite または Genkit を使用)と Python(Flask を使用したノートブックまたはウェブアプリ)で利用できます。今後、さらに多くの言語とフレームワークが追加される予定です。
- (省略可)LangChain フレームワークをアプリに追加する場合は、[LangChain を使用する] オプションを選択します。
- ワークスペースが読み込まれたら、
main.js
ファイルまたは main.py
ファイルを開き、Google AI Studio の Gemini API キーで API_KEY
変数を更新します。
- ウェブ プレビュー パネルでベースアプリをテストして、動作中の Gemini API を観察し、それに応じて新しい Gemini API アプリを変更します。
既存のアプリにGemini APIフォームを追加する
Firebase Studio から直接、既存のアプリに Gemini API を追加することも可能です。
Firebase Studio を開きます。
ナビゲーション パネルで Firebase Studio アイコンをクリックして、Firebase Studio パネルを開きます。
[Google Integrations] セクションを開き、[Gemini API を追加] をクリックします。
プロンプトに従ってアカウントを認証し、Gemini API キーをアプリに追加します。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-01 UTC。
[null,null,["最終更新日 2025-09-01 UTC。"],[],[],null,["While you can use [the App Prototyping agent](/docs/studio/get-started-ai)\nto automatically create a new app prototype with the Gemini API, you can\nalso launch a blank canvas with the\n[Gemini Developer API](https://ai.google.dev/) through one click of\na button. Start using the latest generative AI models from Google in your\napp with a template that includes all the Gemini API infrastructure you\nneed. All you need to do is add your\n[Gemini API key](https://ai.google.dev/tutorials/setup) and get coding!\n\nBuild a new app with the Gemini API pre-loaded\n\nAccess the Firebase Studio Gemini API template from the\ntemplates dashboard and build with the power of AI.\n\n1. Open the [Firebase Studio template for the Gemini API](https://studio.firebase.google.com//new/gemini) from the Firebase Studio template dashboard.\n2. Select the language and framework for your environment. The Gemini API template in Firebase Studio is available in JavaScript (with Vite or Genkit) and Python (notebook or web app with Flask), with more languages and frameworks coming soon.\n3. *(Optional)* If you want to add the [LangChain](https://www.langchain.com/) framework to your app, select the **Use LangChain** option.\n4. When your workspace loads, open the `main.js` or `main.py` file and update the `API_KEY` variable with your Gemini API key from [Google AI Studio](https://aistudio.google.com/app/apikey).\n5. Test the base app in the web preview panel to watch the Gemini API in action, and modify your new Gemini API app accordingly.\n\nAdd the Gemini API to an existing app\n\nYou can also add the Gemini API to your existing app directly from\nFirebase Studio.\n\n1. Open [Firebase Studio](https://studio.firebase.google.com/).\n\n2. Click the Firebase Studio icon from the navigation pane to open the\n Firebase Studio panel.\n\n3. Expand the **Google Integrations** section and click **Add Gemini API**.\n\n4. Follow the prompts to authenticate your account and add a Gemini API key\n to your app."]]