{"id":13492896,"url":"https://github.com/tom-doerr/zsh_codex","last_synced_at":"2025-10-03T17:32:07.248Z","repository":{"id":37192859,"uuid":"409708968","full_name":"tom-doerr/zsh_codex","owner":"tom-doerr","description":"This is a ZSH plugin that enables you to use OpenAI's Codex AI in the command line.","archived":false,"fork":false,"pushed_at":"2025-03-22T23:56:40.000Z","size":74,"stargazers_count":1582,"open_issues_count":17,"forks_count":85,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-05-12T12:01:31.845Z","etag":null,"topics":["ai","codex","openai","zsh"],"latest_commit_sha":null,"homepage":"","language":"Python","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/tom-doerr.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,"zenodo":null}},"created_at":"2021-09-23T18:50:33.000Z","updated_at":"2025-05-11T02:10:13.000Z","dependencies_parsed_at":"2023-12-23T02:50:57.905Z","dependency_job_id":"75bbcf45-4cc1-47e5-8634-f294090be724","html_url":"https://github.com/tom-doerr/zsh_codex","commit_stats":{"total_commits":89,"total_committers":19,"mean_commits":4.684210526315789,"dds":0.4831460674157303,"last_synced_commit":"9fd50c485f24ecef779d07c783e5a348c079a89d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom-doerr%2Fzsh_codex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom-doerr%2Fzsh_codex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom-doerr%2Fzsh_codex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom-doerr%2Fzsh_codex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tom-doerr","download_url":"https://codeload.github.com/tom-doerr/zsh_codex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254140768,"owners_count":22021220,"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","codex","openai","zsh"],"created_at":"2024-07-31T19:01:10.278Z","updated_at":"2025-10-03T17:32:02.201Z","avatar_url":"https://github.com/tom-doerr.png","language":"Python","readme":"\u003ch1 align=\"center\"\u003e⌨️ 🦾 Zsh Codex\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    AI in the command line.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/tom-doerr/zsh_codex/stargazers\"\n        \u003e\u003cimg\n            src=\"https://img.shields.io/github/stars/tom-doerr/zsh_codex?colorA=2c2837\u0026colorB=c9cbff\u0026style=for-the-badge\u0026logo=starship style=flat-square\"\n            alt=\"Repository's starts\"\n    /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/tom-doerr/zsh_codex/issues\"\n        \u003e\u003cimg\n            src=\"https://img.shields.io/github/issues-raw/tom-doerr/zsh_codex?colorA=2c2837\u0026colorB=f2cdcd\u0026style=for-the-badge\u0026logo=starship style=flat-square\"\n            alt=\"Issues\"\n    /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/tom-doerr/zsh_codex/blob/main/LICENSE\"\n        \u003e\u003cimg\n            src=\"https://img.shields.io/github/license/tom-doerr/zsh_codex?colorA=2c2837\u0026colorB=b5e8e0\u0026style=for-the-badge\u0026logo=starship style=flat-square\"\n            alt=\"License\"\n    /\u003e\u003cbr /\u003e\n    \u003ca href=\"https://github.com/tom-doerr/zsh_codex/commits/main\"\n\t\t\u003e\u003cimg\n\t\t\tsrc=\"https://img.shields.io/github/last-commit/tom-doerr/zsh_codex/main?colorA=2c2837\u0026colorB=ddb6f2\u0026style=for-the-badge\u0026logo=starship style=flat-square\"\n\t\t\talt=\"Latest commit\"\n    /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/tom-doerr/zsh_codex\"\n        \u003e\u003cimg\n            src=\"https://img.shields.io/github/repo-size/tom-doerr/zsh_codex?colorA=2c2837\u0026colorB=89DCEB\u0026style=for-the-badge\u0026logo=starship style=flat-square\"\n            alt=\"GitHub repository size\"\n    /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src='https://github.com/tom-doerr/bins/raw/main/zsh_codex/zc4.gif'\u003e\n    \u003cp align=\"center\"\u003e\n        You just need to write a comment or variable name and the AI will write the corresponding code.\n    \u003c/p\u003e\n\u003c/p\u003e\n\n## What is it?\n\nThis is a ZSH plugin that enables you to use AI powered code completion in the command line. It now supports both OpenAI's Codex and Google's Generative AI (Gemini). OpenAI Codex is the AI that also powers GitHub Copilot, while Gemini is Google's advanced language model.\n\n## How do I install it?\n\n### Manual Installation\n\n1. Install the OpenAI package, the Google package, or boto3.\n\n```bash\npip3 install openai\n```\n\nor\n\n```bash\npip3 install google-generativeai\n```\n\nor\n\n```bash\npip3 install boto3\n```\n\n2. Download the ZSH plugin.\n\n```bash\ngit clone https://github.com/tom-doerr/zsh_codex.git ~/.oh-my-zsh/custom/plugins/zsh_codex \n```\n\n3. Add the following to your `.zshrc` file.\n\nUsing oh-my-zsh:\n\n```bash\n    plugins=(zsh_codex)\n    bindkey '^X' create_completion\n```\n\nWithout oh-my-zsh:\n\n```bash\n    # in your/custom/path you need to have a \"plugins\" folder and in there you clone the repository as zsh_codex\n    export ZSH_CUSTOM=\"your/custom/path\"\n    source \"$ZSH_CUSTOM/plugins/zsh_codex/zsh_codex.plugin.zsh\"\n    bindkey '^X' create_completion\n```\n\n4. Create a file called `zsh_codex.ini` in `~/.config`.\n   Example:\n\n```ini\n; Primary service configuration\n; Set 'service' to match one of the defined sections below.\n[service]\nservice = groq_service\n\n; Example configuration for a self-hosted Ollama service.\n[my_ollama]\napi_type = openai\napi_key = dummy_key\nmodel = llama3.1\nbase_url = http://localhost:11434/v1\n\n; OpenAI service configuration\n; Provide the 'api_key' and specify a 'model' if needed.\n[openai_service]\napi_type = openai\napi_key = \u003copenai_apikey\u003e\n\n; Groq service configuration\n; Provide the 'api_key'.\n[groq_service]\napi_type = groq\napi_key = \u003cgroq_apikey\u003e\nmodel = gemma2-9b-it\n\n; Mistral service configuration\n; Provide the 'api_key'.\n[mistral_service]\napi_type = mistral\napi_key = \u003cmistral_apikey\u003e\nmodel = mistral-small-latest\n```\n\nIn this configuration file, you can define multiple services with their own configurations. The required and optional parameters of the `api_type` are specified in `services/sevices.py`. Choose which service to use in the `[service]` section.\n\n6. Run `zsh`, start typing and complete it using `^X`!\n7. If you use virtual environments you can set `ZSH_CODEX_PYTHON` to python executable where `openai` or `google-generativeai` is installed.\n   e.g. for `miniconda` you can use:\n\n```bash\nexport ZSH_CODEX_PYTHON=\"$HOME/miniconda3/bin/python\"\n```\n\n### Fig Installation\n\n\u003ca href=\"https://fig.io/plugins/other/zsh_codex_tom-doerr\" target=\"_blank\"\u003e\u003cimg src=\"https://fig.io/badges/install-with-fig.svg\" /\u003e\u003c/a\u003e\n\n## Troubleshooting\n\n### Unhandled ZLE widget 'create_completion'\n\n```\nzsh-syntax-highlighting: unhandled ZLE widget 'create_completion'\nzsh-syntax-highlighting: (This is sometimes caused by doing `bindkey \u003ckeys\u003e create_completion` without creating the 'create_completion' widget with `zle -N` or `zle -C`.)\n```\n\nAdd the line\n\n```\nzle -N create_completion\n```\n\nbefore you call `bindkey` but after loading the plugin (`plugins=(zsh_codex)`).\n\n### Already exists and is not an empty directory\n\n```\nfatal: destination path '~.oh-my-zsh/custom/plugins'\n```\n\nTry to download the ZSH plugin again.\n\n```\ngit clone https://github.com/tom-doerr/zsh_codex.git ~/.oh-my-zsh/custom/plugins/zsh_codex\n```\n\n---\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.buymeacoffee.com/TomDoerr\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;\" \u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Passing in context\n\nSince the current filesystem is not passed into the ai you will need to either\n1. Pass in all context in your descriptive command\n2. Use a command to collect the context\n\nIn order for option 2 to work you will need to first add `export ZSH_CODEX_PREEXECUTE_COMMENT=\"true\"` to your .zshrc file to enable the feature. \n\n\u003e [!WARNING]\n\u003e This will run your prompt using zsh each time before using it, which could potentially modify your system when you hit ^X.\n\nOnce you've done that and restarted your shell you can do things like this:\n\n`# git add all files. Also commit the current changeset with a descriptive message based on $(git diff). Then git push`\n\n## More usage examples\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src='https://github.com/tom-doerr/bins/raw/main/zsh_codex/update_insert/all.gif'\u003e\n    \u003cp align=\"center\"\u003e\n    \u003c/p\u003e\n\u003c/p\u003e\n\n---\n\n[Fish Version](https://github.com/tom-doerr/codex.fish)\n\n[Traffic Statistics](https://tom-doerr.github.io/github_repo_stats_data/tom-doerr/zsh_codex/latest-report/report.html)\n","funding_links":["https://www.buymeacoffee.com/TomDoerr"],"categories":["Plugins","Python","Browser-extensions","Demos","🚀 AI Tools for Vim, Neovim, and Terminal"],"sub_categories":["ZSH on Windows","Products \u0026 tools"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftom-doerr%2Fzsh_codex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftom-doerr%2Fzsh_codex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftom-doerr%2Fzsh_codex/lists"}