3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GASからGemini APIを呼び出す

3
Last updated at Posted at 2026-10-10

APIキーの発行

  • 以下からAPIキーを発行する

APIキーの登録

  • 以下から環境変数のように登録
  • 「プロジェクトの設定」>「スクリプトプロパティ」

Generative Language API の有効化

  • 以下で有効化する

GASにGemini APIを利用する処理の記述

  • gemini-3.8-flash を使ってうまくいった

  • https://generativelanguage.googleapis.com/v1beta/models/${MODEL_NAME}:generateContent?key=${GEMINI_API_KEY} のようなエンドポイントを叩いてLLMのレスポンスを取得

    • MODEL_NAMEは文字列でgemini-3.8-flashなど
    • GEMINI_API_KEYスクリプトプロパティから取得 PropertiesService.getScriptProperties().getProperty('キー名') のようにとる

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?