{"id":28497268,"url":"https://github.com/google-gemini/gemini-api-quickstart","last_synced_at":"2025-07-03T10:32:34.335Z","repository":{"id":256442036,"uuid":"853516073","full_name":"google-gemini/gemini-api-quickstart","owner":"google-gemini","description":"Get up and running with the Gemini API in under 5 minutes (with Python)","archived":false,"fork":false,"pushed_at":"2024-12-23T14:40:24.000Z","size":145,"stargazers_count":293,"open_issues_count":3,"forks_count":41,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-23T15:33:58.060Z","etag":null,"topics":["gemini","gemini-api"],"latest_commit_sha":null,"homepage":"https://ai.google.dev/gemini-api/docs/quickstart","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google-gemini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-06T20:13:41.000Z","updated_at":"2024-12-23T14:40:21.000Z","dependencies_parsed_at":"2024-09-10T19:27:48.399Z","dependency_job_id":"838c5911-6658-4461-83b5-fcb7a2acc98c","html_url":"https://github.com/google-gemini/gemini-api-quickstart","commit_stats":null,"previous_names":["google-gemini/gemini-api-quickstart"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-gemini%2Fgemini-api-quickstart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-gemini%2Fgemini-api-quickstart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-gemini%2Fgemini-api-quickstart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-gemini%2Fgemini-api-quickstart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google-gemini","download_url":"https://codeload.github.com/google-gemini/gemini-api-quickstart/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google-gemini%2Fgemini-api-quickstart/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258716771,"owners_count":22746170,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gemini","gemini-api"],"created_at":"2025-06-08T13:05:41.369Z","updated_at":"2025-07-03T10:32:33.971Z","avatar_url":"https://github.com/google-gemini.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gemini API Quickstart - Python\n\nThis repository contains a simple Python Flask App running with the Google AI Gemini API, designed to get you started building with Gemini's multi-modal capabilities. The app comes with a basic UI and a Flask backend.\n\n\u003cimg width=\"1271\" alt=\"Screenshot 2024-05-07 at 7 42 28 AM\" src=\"https://github.com/logankilpatrick/gemini-api-quickstart/assets/35577566/156ae3e0-cffa-47a3-8a71-1bded78c4632\"\u003e\n\n## Basic request\n\nTo send your first API request with the [Google Gen AI SDK](https://ai.google.dev/gemini-api/docs/libraries#python), make sure you have the right dependencies installed (see installation steps below) and then run the following code:\n\n```python\nfrom google import genai\n\nclient = genai.Client(api_key=\"GEMINI_API_KEY\")\nchat = client.chats.create(model=\"gemini-2.0-flash\")\n\nresponse = chat.send_message(\"Hello world!\")\nprint(response.text)\n\nresponse = chat.send_message(\"Explain to me how AI works\")\nprint(response.text)\n\nfor message in chat.get_history():\n    print(f'role - {message.role}',end=\": \")\n    print(message.parts[0].text)\n```\n\n## Setup\n\n1. If you don’t have Python installed, install it [from Python.org](https://www.python.org/downloads/).\n\n2. [Clone](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) this repository.\n\n3. Create a new virtual environment:\n\n   - macOS:\n     ```bash\n     $ python -m venv venv\n     $ . venv/bin/activate\n     ```\n\n   - Windows:\n     ```cmd\n     \u003e python -m venv venv\n     \u003e .\\venv\\Scripts\\activate\n     ```\n\n   - Linux:\n      ```bash\n      $ python -m venv venv\n      $ source venv/bin/activate\n      ```\n\n4. Install the requirements:\n\n   ```bash\n   $ pip install -r requirements.txt\n   ```\n\n5. Make a copy of the example environment variables file:\n\n   ```bash\n   $ cp .env.example .env\n   ```\n\n6. Add your [API key](https://ai.google.dev/gemini-api/docs/api-key) to the newly created `.env` file or as an environment variable.\n\n7. Run the app:\n\n```bash\n$ flask run\n```\n\nYou should now be able to access the app from your browser at the following URL: [http://localhost:5000](http://localhost:5000)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-gemini%2Fgemini-api-quickstart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle-gemini%2Fgemini-api-quickstart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle-gemini%2Fgemini-api-quickstart/lists"}