{"id":21906298,"url":"https://github.com/alfex4936/bard-rs","last_synced_at":"2025-07-09T05:07:08.191Z","repository":{"id":157918773,"uuid":"633719014","full_name":"Alfex4936/Bard-rs","owner":"Alfex4936","description":"Google Gemini CLI with Rust (Previsouly Bard)","archived":false,"fork":false,"pushed_at":"2024-07-25T08:08:19.000Z","size":42,"stargazers_count":84,"open_issues_count":2,"forks_count":16,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-22T17:15:46.872Z","etag":null,"topics":["api","bard","chatbot","cli","gemini","google","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Alfex4936.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":"2023-04-28T06:06:45.000Z","updated_at":"2025-06-05T19:00:56.000Z","dependencies_parsed_at":"2024-02-12T11:43:10.264Z","dependency_job_id":null,"html_url":"https://github.com/Alfex4936/Bard-rs","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/Alfex4936/Bard-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alfex4936%2FBard-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alfex4936%2FBard-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alfex4936%2FBard-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alfex4936%2FBard-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alfex4936","download_url":"https://codeload.github.com/Alfex4936/Bard-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alfex4936%2FBard-rs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264396660,"owners_count":23601545,"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":["api","bard","chatbot","cli","gemini","google","rust"],"created_at":"2024-11-28T16:43:40.159Z","updated_at":"2025-07-09T05:07:08.160Z","avatar_url":"https://github.com/Alfex4936.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cimg src=\"https://user-images.githubusercontent.com/2356749/235068474-5daddf05-54d6-4391-ae97-1a944aebdec6.png\" style=\"height: 32px\"\u003e Google Gemini CLI\n\nA simple command line interface for interacting with Google Gemini (Previously `Bard`), written in Rust.\n\nThis CLI allows you to save chat history as a Markdown file at a specified absolute or relative path in realtime\n\nand handles graceful exit with Ctrl+C.\n\n![image](https://github.com/Alfex4936/Bard-rs/assets/2356749/168fbea0-fb85-4cc3-ae16-c6936b17b2c1)\n\n---\n\n![output](https://github.com/Alfex4936/Bard-rs/assets/2356749/1a81dc59-2be0-4812-afcc-537c29f71919)\n\n## Prerequisites\n\nYou need to have Rust and Cargo installed on your system. If you don't have them, you can install them from the [official Rust website](https://www.rust-lang.org/tools/install).\n\n## Installation\n\nInstall from cargo. Add `-f` at the end to force update. (`cargo install bard-rs -f`)\n\n```bash\ncargo install bard-rs\n```\n\nor\n\n1. Clone the repository to your local machine:\n\n   ```\n   git clone https://github.com/Alfex4936/Bard-rs\n   ```\n\n2. Change the working directory:\n\n   ```\n   cd Bard-rs\n   ```\n\n3. Build the project:\n\n   ```\n   cargo build --release\n   ```\n\nThe executable binary file will be located in the `target/release` folder.\n\n## Usage\n\nBefore using the Google Gemini CLI, you need to obtain your session cookie. To get the session cookie, follow these steps:\n\n1. Go to [Google Gemini](https://gemini.google.com/) in Chrome.\n2. Open Chrome Developer Tools (F12 or `Ctrl + Shift + I`).\n3. Go to the \"Application\" tab.\n4. Under \"Storage\" \u003e \"Cookies\", click on \"https://gemini.google.com\".\n5. Find the cookies with the name `__Secure-1PSID` (Must) and `__Secure-1PSIDTS` (Optional), and copy the values.\n\nNow you can use the Google Gemini CLI:\n\n\u003e Supported options: `-s` (__Secure-1PSID cookie), `-t` (__Secure-1PSIDTS cookie), `-m` (if present, it'll print other Gemini's responses for your prompt), `-p` (if present with path, it'll save your chat history as markdown.), `-e` (if present with .env file location, it'll use that session cookie)\n\nIt'll save as your first prompt message. (eg: \"Hey yo\" -\u003e gemini_hey_yo.md)\n\n```\nbard-rs --psid \u003cyour_psid\u003e --psidts \u003cyour_psidts\u003e --path ./\n\nbard-rs --psid \u003cyour_psid\u003e --path ./\n```\n\nReplace `\u003cyour_psid\u003e` and `\u003cyour_psidts\u003e` with the value you copied from the Developer Tools.\n\nIf you don't want to save the chat history as a Markdown file, skip `--path`:\n\n```\nbard-rs -p \u003cyour_psid\u003e\n```\n\nIf you don't want to pass that long session in terminal, use `.env` file (refer to `.env_sample`)\n\n```\nbard-rs -e .env -p ./\n```\n\nIf you prefer not to specify a path, `bard-rs` will automatically search for the .env file in the following locations: the argument-provided path, the current working directory, and the directory of the bard-rs binary.\n\n(`GEMINI_HISTORY` is required in `.env` if you want to save the chat history as markdown file everytime.)\n\n```\nbard-rs\n```\n\nabove command is same as `bard-rs -e .env`\n\n`.env` file must contain `PSID` key. (it is derived from `__Secure-1PSID`)\n\n\u003e ![IMPORTANT]\n\u003e Need `__Secure-1PSID` and `__Secure-1PSIDTS`\n\n\u003e ! using `echo PSID=... \u003e .env` might cause encoding problem that `dotenv` cannot read and end up causing no session key error.\n\n```\nPSID=~.\n```\n\n## Resolving \"SNlM0e not found\" Error\n\u003e [!IMPORTANT]\n\u003e if you are getting \"SNlM0e not found. Check your cookies.\" even with `__Secure-1PSIDTS`\n\n1. Clear your cookies. (In Chrome, DevTools - Application - Cookies)\n2. Login again.\n3. Obtain new `__Secure-1PSID` (Seems like typically contains a numerical identifier representing the logged-in user.)\n\n## Commands\n\n- Type your message and press Enter to send it to Google Gemini.\n- Type `!reset` to reset the conversation.\n- Type `!exit` to exit the CLI.\n- Type `!show` to see other Gemini's answers for your last message.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n\nCredits:\n- [acheong08](https://github.com/acheong08) - Inspired by this Python version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falfex4936%2Fbard-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falfex4936%2Fbard-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falfex4936%2Fbard-rs/lists"}