Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
**/.python-version
**/desktop.ini
**.lnk
**/.env

# Ignore fork-syncing workflow, should only exist in forks
# cf. https://github.com/Giom-V/gemini-api-cookbook/blob/main/.github/workflows/sync.yml
Expand Down
10 changes: 9 additions & 1 deletion quickstarts/Get_started_LiveAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,15 @@

DEFAULT_MODE = "camera"

client = genai.Client(http_options={"api_version": "v1beta"})
api_key = os.environ.get("GOOGLE_API_KEY")

if api_key is None:
print("Please set the GOOGLE_API_KEY environment variable.")
print("You can get an API key from https://aistudio.google.com/app/apikey")
while not api_key:
api_key = input("Or enter your API key here: ").strip()

client = genai.Client(api_key=api_key, http_options={"api_version": "v1beta"})

CONFIG = {"response_modalities": ["AUDIO"]}

Expand Down