{"id":23156000,"url":"https://github.com/hostinger-bot/btch-gemini","last_synced_at":"2025-05-08T23:06:53.581Z","repository":{"id":267193558,"uuid":"900505820","full_name":"hostinger-bot/btch-gemini","owner":"hostinger-bot","description":"btch-gemini is a Node.js package for interacting with the Gemini API.","archived":false,"fork":false,"pushed_at":"2025-04-27T02:43:14.000Z","size":2233,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-08T23:06:36.026Z","etag":null,"topics":["ai","gemini-api"],"latest_commit_sha":null,"homepage":"http://docs.gemini-api.zone.id/","language":"JavaScript","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/hostinger-bot.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-08T23:36:26.000Z","updated_at":"2025-04-30T22:23:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"1104df07-2974-4f94-b0af-6581ff1735cb","html_url":"https://github.com/hostinger-bot/btch-gemini","commit_stats":null,"previous_names":["hostinger-bot/btch-gemini"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hostinger-bot%2Fbtch-gemini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hostinger-bot%2Fbtch-gemini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hostinger-bot%2Fbtch-gemini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hostinger-bot%2Fbtch-gemini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hostinger-bot","download_url":"https://codeload.github.com/hostinger-bot/btch-gemini/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253160777,"owners_count":21863629,"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":["ai","gemini-api"],"created_at":"2024-12-17T21:12:15.780Z","updated_at":"2025-05-08T23:06:53.567Z","avatar_url":"https://github.com/hostinger-bot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# btch-gemini Unofficial Module\n\n## Description\n\n**btch-gemini** is a lightweight Node.js package for seamlessly interacting with the Gemini API. It provides simple, efficient methods for sending chat prompts, processing image descriptions, and handling various media types like audio and video with robust error handling.\n\n## Prerequisites\n\n- Node.js version 16 or higher\n- An active internet connection\n- API access to the Gemini service\n\n## Installation\n\nInstall the package using npm:\n\n```bash\nnpm install btch-gemini\n```\n\n## Features\n\n- 🤖 `gemini_chat`: Send text prompts to the Gemini chat API\n- 🖼️ `gemini_image`: Process image descriptions using text prompts and image URLs\n- 🎨 `gemini_imgedit`: Edit image descriptions using text prompts and image URLs\n- 🎵 `gemini_audio`: Process audio files from URLs\n- 🎥 `gemini_video`: Analyze video files from URLs\n- 🧠 `gemini_history`: Retrieve past interactions to continue conversations\n- 🔐 Comprehensive input validation\n- 🚀 Easy-to-use asynchronous methods\n\n## Usage\n\n### Import the Package\n\n```javascript\nconst Gemini = require('btch-gemini');\n```\n\n### ESM\n```javascript\nimport pkg from 'btch-gemini';\nconst Gemini = pkg;\n```\n\n### Chat Interaction\n\n```javascript\nasync function chatExample() {\n    try {\n        const prompt = \"Hello, how are you?\";\n        const response = await Gemini.gemini_chat(prompt);\n        console.log(response);\n    } catch (error) {\n        console.error('Chat Error:', error.message);\n    }\n}\n```\n\n### Image Processing\n\n```javascript\nasync function imageExample() {\n    try {\n        const prompt = \"What is this image about?\";\n        const imageUrl = \"https://files.catbox.moe/a13ppy.jpg\";\n        const response = await Gemini.gemini_image(prompt, imageUrl);\n        console.log(response);\n    } catch (error) {\n        console.error('Image Processing Error:', error.message);\n    }\n}\n```\n### Image Edit\n\n```javascript\nasync function imageeditExample() {\n    try {\n        const prompt = \"Transform this into a watercolor painting\";\n        const imageUrl = \"https://files.catbox.moe/a13ppy.jpg\";\n        const response = await Gemini.gemini_imgedit(prompt, imageUrl);\n        console.log(response); // image buffer \n    } catch (error) {\n        console.error('Edit Image Error:', error.message);\n    }\n}\n```\n\n\n### Audio Processing\n\n```javascript\nasync function audioExample() {\n    try {\n        const audioUrl = \"https://files.catbox.moe/pj7g2g.opus\"; // URL AUDIO\n        let prompt = \"Please transcribe this audio\"\n        const response = await Gemini.gemini_audio(audioUrl, prompt);\n        console.log(response);\n    } catch (error) {\n        console.error('Audio Processing Error:', error.message);\n    }\n}\n```\n\n### Video Processing\n\n```javascript\nasync function videoExample() {\n    try {\n        const videoUrl = \"https://files.catbox.moe/4fozd2.mp4\";\n       let prompt = \"Please describe this video and transcribe the audio\"\n        const response = await Gemini.gemini_video(videoUrl, prompt)\n        console.log(response);\n    } catch (error) {\n        console.error('Video Processing Error:', error.message);\n    }\n}\n```\n\n### History Interaction\n\n```javascript\nasync function historyExample() {\n    try {\n        const history = [\n            { role: \"user\", content: \"Hai! Nama saya Tio\" },\n            { role: \"assistant\", content: \"Halo Tio, Senang bertemu dengan mu.\" },\n            { role: \"user\", content: \"Siapa nama saya yah jelaskan arti nama saya\" }\n        ];\n        const response = await Gemini.gemini_history(history);\n        console.log(response);\n    } catch (error) {\n        console.error('History Interaction Error:', error.message);\n    }\n}\n```\n\n### System Prompt and Query\n\n```javascript\nasync function promptExample() {\n    try {\n        const systemPrompt = \"This is a system instruction\";\n        const query = \"What is the meaning of life?\";\n        const response = await Gemini.gemini_prompt(systemPrompt, query);\n        console.log(response);\n    } catch (error) {\n        console.error('Prompt Interaction Error:', error.message);\n    }\n}\n```\n\n## Error Handling\n\nThe package provides detailed error messages:\n\n- `gemini_chat`: Validates prompt input\n- `gemini_image`: Validates both prompt and image URL\n- `gemini_audio`: Validates audio URL\n- `gemini_video`: Validates video URL\n- `gemini_history`: Ensures valid message structure\n- `gemini_prompt`: Validates prompt and query\n- Errors are thrown for invalid inputs or API communication issues\n- `gemini_imgedit`: Validates both prompt and image URL\n\n## API Endpoints\n\n- Chat API: `https://gemini-api.zone.id/gemini/chat`\n- Image API: `https://gemini-api.zone.id/gemini/image`\n- Audio API: `https://gemini-api.zone.id/gemini/audio`\n- Video API: `https://gemini-api.zone.id/gemini/video`\n- Edit API: `https://gemini-api.zone.id/gemini/imgedit`\n- History API: `https://gemini-api.zone.id/gemini/history`\n- Prompt API: `https://gemini-api.zone.id/gemini/prompt`\n\n## Support\n\nIf you encounter any issues or have questions, please [open an issue](https://github.com/hostinger-bot/btch-gemini/issues) on GitHub.\n\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhostinger-bot%2Fbtch-gemini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhostinger-bot%2Fbtch-gemini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhostinger-bot%2Fbtch-gemini/lists"}