{"id":13463995,"url":"https://github.com/maurobonfietti/chat-open-ai-cli","last_synced_at":"2026-01-07T22:57:50.038Z","repository":{"id":80011528,"uuid":"601754178","full_name":"maurobonfietti/chat-open-ai-cli","owner":"maurobonfietti","description":":robot: Ask questions to ChatGPT from the CLI.","archived":false,"fork":false,"pushed_at":"2024-07-18T19:55:02.000Z","size":821,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-29T16:22:21.217Z","etag":null,"topics":["api","chatgpt","cli","gpt","gpt-3","gpt-4","openai","openai-api","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/maurobonfietti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-02-14T18:43:54.000Z","updated_at":"2024-07-18T19:55:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"8d26450b-895d-4fad-a638-1779f559c105","html_url":"https://github.com/maurobonfietti/chat-open-ai-cli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maurobonfietti%2Fchat-open-ai-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maurobonfietti%2Fchat-open-ai-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maurobonfietti%2Fchat-open-ai-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maurobonfietti%2Fchat-open-ai-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maurobonfietti","download_url":"https://codeload.github.com/maurobonfietti/chat-open-ai-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245435179,"owners_count":20614853,"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","chatgpt","cli","gpt","gpt-3","gpt-4","openai","openai-api","php"],"created_at":"2024-07-31T14:00:31.824Z","updated_at":"2026-01-07T22:57:50.024Z","avatar_url":"https://github.com/maurobonfietti.png","language":"PHP","funding_links":["https://ko-fi.com/maurobonfietti"],"categories":["Awesome PHP Open AI Projects"],"sub_categories":[],"readme":"# ChatGPT from the CLI\n\n:robot: Ask questions to ChatGPT from the CLI.\n\n![alt text](multimedia/ScreenshotChatGpt5Cli.png \"Screenshot: Chat using OpenAI API from CLI\")\n\n------\n\n## GETTING STARTED:\n\n\u003e **Requires PHP 8.1+**\n\n### Clone repository with git and install dependencies:\n\nIn your terminal execute:\n\n```bash\ngit clone https://github.com/maurobonfietti/chat-open-ai-cli\ncd chat-open-ai-cli\ncp .env.example .env\ncomposer install\n```\n\n\n### Configure your OpenAI API KEY:\n\nEdit your `.env` file:\n\n```\nOPEN_AI_SECRET_API_KEY='Your-Open-AI-Secret-Api-Key-Goes-Here'\n```\n\n\n### Get your API KEY from OpenAI:\n\nCreate an account on **OpenAI** to get your **API KEY**.\n\n#### Screenshot from OpenAI Platform:\n\n\u003cp align=\"left\"\u003e\n    \u003cimg src=\"multimedia/ScreenshotApiKey.png\" width=\"400\" alt=\"Screenshot: Get your API KEY from OPEN AI Platform.\"\u003e\n\u003c/p\u003e\n\n------\n\n\n## USAGE:\n\nChat to OpenAI from CLI with this command:\n\n```bash\nphp console chat\n```\n\n\n## OPTIONS:\n\nTo use OpenAI **GPT-5** API:\n\n```bash\nphp console chat --gpt5\n```\n\n\nTo use OpenAI **GPT-4** API:\n\n```bash\nphp console chat --gpt4\n```\n\n\nAllow **multiline** with this command:\n\n```bash\nphp console chat --multiline\n```\n\n\nGet help and more info:\n\n```bash\nphp console chat --help\n```\n\n\nCheck command version:\n\n```bash\nphp console --version\n```\n\n\u003e *I'm using the alias: `chat` equivalent to: `php console chat`*.\n\n\n## DEMO:\n\n:video_camera: :movie_camera: See the video on Youtube: [I ask the OpenAI API questions from the CLI.](https://youtu.be/DQvyp_vvxEQ)\n\nhttps://user-images.githubusercontent.com/24535949/222997557-465e395e-be28-417c-be79-0b3710a30f67.mp4\n\n\n## DEPENDENCIES:\n\n- [openai-php/client](https://github.com/openai-php/client): Supercharged community PHP API client that allows you to interact with the Open AI API.\n- [symfony/console](https://github.com/symfony/console): The Console component eases the creation of beautiful and testable command line interfaces.\n- [vlucas/phpdotenv](https://github.com/vlucas/phpdotenv): Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.\n\n\n## CONFIGURE YOUR OPEN AI ACCOUNT:\n\nWhen you create your account on **OpenAI**, you can get some free credits (like 18 USD on credits -at the time of writing this-). You can set your prefered payment method (Credit Card for instance).\n\n#### Screenshot from OpenAI Platform:\n\n\u003cp align=\"left\"\u003e\n    \u003cimg src=\"multimedia/ScreenshotPayment.png\" width=\"200\" alt=\"Screenshot: Payment Method: Credit Card.\"\u003e\n\u003c/p\u003e\n\n------\n\nAlso, you can set and configure the usage limits (Hard Limit and Soft Limit).\n\n#### Screenshot from OpenAI Platform:\n\n![alt text](multimedia/ScreenshotLimits.png \"Screenshot: Usage Limits.\")\n\n------\n\n#### Screenshot from OpenAI Platform:\n\n![alt text](multimedia/ScreenshotUsage.png \"Account Usage Stats.\")\n\n------\n\n\n## HELPFUL EXTERNAL LINKS:\n\nhttps://openai.com/api/pricing/\n\nhttps://platform.openai.com/tokenizer\n\nhttps://platform.openai.com/account/usage\n\nhttps://platform.openai.com/docs/quickstart/adjust-your-settings\n\nhttps://platform.openai.com/docs/models/finding-the-right-model\n\n\n## LICENSE:\n\n:page_facing_up: The MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat\n\n\n## WOULD YOU LIKE TO SUPPORT THIS PROJECT?\n\n:heart: You can support this project inviting me a coffee :coffee: :yum: or giving a **star** to this repo :star: :blush:.\n\n[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/maurobonfietti)\n\n\n## THAT'S IT!\n\n:partying_face: Now go and ask interesting questions to **ChatGPT** from the CLI :computer: :robot:.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaurobonfietti%2Fchat-open-ai-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaurobonfietti%2Fchat-open-ai-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaurobonfietti%2Fchat-open-ai-cli/lists"}