環境変数

GOOGLE_APPLICATION_CREDENTIALS

Google Cloud認証用のサービスアカウントキーファイル、または資格情報構成ファイルへのパスを指定します。

使い方・用途

  • 「Could not load the default credentials」エラーが発生した際、特定のサービスアカウントを使用して認証を完了させるために指定します。
  • v2.1.121以降でサポートされたWorkload Identity Federationを利用した高度な認証連携を行う際に、構成ファイルのパスを指定する目的で使用します。
英語原文(公式ドキュメントより)

Claude Code uses ANTHROPIC_VERTEX_PROJECT_ID as the project ID for Vertex AI requests. The GCLOUD_PROJECT and GOOGLE_CLOUD_PROJECT environment variables and the credential file referenced by GOOGLE_APPLICATION_CREDENTIALS take precedence over it. If none of these are set, the project ID is resolved from your gcloud configuration or the attached service account.