Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tom-doerr/zsh_codex
This is a ZSH plugin that enables you to use OpenAI's Codex AI in the command line.
https://github.com/tom-doerr/zsh_codex
ai codex openai zsh
Last synced: 28 days ago
JSON representation
This is a ZSH plugin that enables you to use OpenAI's Codex AI in the command line.
- Host: GitHub
- URL: https://github.com/tom-doerr/zsh_codex
- Owner: tom-doerr
- License: mit
- Created: 2021-09-23T18:50:33.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-22T02:14:45.000Z (about 2 months ago)
- Last Synced: 2024-09-29T08:04:23.217Z (about 1 month ago)
- Topics: ai, codex, openai, zsh
- Language: Python
- Homepage:
- Size: 62.5 KB
- Stars: 1,412
- Watchers: 18
- Forks: 71
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rainmana - tom-doerr/zsh_codex - This is a ZSH plugin that enables you to use OpenAI's Codex AI in the command line. (Python)
- awesome-codex - Zsh Codex - AI in the command line
- project-awesome - tom-doerr/zsh_codex - This is a ZSH plugin that enables you to use OpenAI's Codex AI in the command line. (Python)
- jimsghstars - tom-doerr/zsh_codex - This is a ZSH plugin that enables you to use OpenAI's Codex AI in the command line. (Python)
README
⌨️ 🦾 Zsh Codex
AI in the command line.
You just need to write a comment or variable name and the AI will write the corresponding code.
## What is it?
This 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.
## How do I install it?
### Manual Installation
1. Install the OpenAI package or the Google package.
```bash
pip3 install openai
```or
```bash
pip3 install google-generativeai
```2. Download the ZSH plugin.
```bash
git clone https://github.com/tom-doerr/zsh_codex.git ~/.oh-my-zsh/custom/plugins/zsh_codex
```3. Add the following to your `.zshrc` file.
Using oh-my-zsh:
```bash
plugins=(zsh_codex)
bindkey '^X' create_completion
```Without oh-my-zsh:
```bash
# in your/custom/path you need to have a "plugins" folder and in there you clone the repository as zsh_codex
export ZSH_CUSTOM="your/custom/path"
source "$ZSH_CUSTOM/plugins/zsh_codex/zsh_codex.plugin.zsh"
bindkey '^X' create_completion
```4. Create a file called `zsh_codex.ini` in `~/.config`.
Example:```ini
; Primary service configuration
; Set 'service' to match one of the defined sections below.
[service]
service = groq_service; Example configuration for a self-hosted Ollama service.
[my_ollama]
api_type = openai
api_key = dummy_key
model = llama3.1
base_url = http://localhost:11434/v1; OpenAI service configuration
; Provide the 'api_key' and specify a 'model' if needed.
[openai_service]
api_type = openai
api_key =; Groq service configuration
; Provide the 'api_key'.
[groq_service]
api_type = groq
api_key =
model = gemma2-9b-it; Mistral service configuration
; Provide the 'api_key'.
[mistral_service]
api_type = mistral
api_key =
model = mistral-small-latest
```In 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.
6. Run `zsh`, start typing and complete it using `^X`!
7. If you use virtual environments you can set `ZSH_CODEX_PYTHON` to python executable where `openai` or `google-generativeai` is installed.
e.g. for `miniconda` you can use:```bash
export ZSH_CODEX_PYTHON="$HOME/miniconda3/bin/python"
```### Fig Installation
## Troubleshooting
### Unhandled ZLE widget 'create_completion'
```
zsh-syntax-highlighting: unhandled ZLE widget 'create_completion'
zsh-syntax-highlighting: (This is sometimes caused by doing `bindkey create_completion` without creating the 'create_completion' widget with `zle -N` or `zle -C`.)
```Add the line
```
zle -N create_completion
```before you call `bindkey` but after loading the plugin (`plugins=(zsh_codex)`).
### Already exists and is not an empty directory
```
fatal: destination path '~.oh-my-zsh/custom/plugins'
```Try to download the ZSH plugin again.
```
git clone https://github.com/tom-doerr/zsh_codex.git ~/.oh-my-zsh/custom/plugins/zsh_codex
```---
## More usage examples
---
[Fish Version](https://github.com/tom-doerr/codex.fish)
[Traffic Statistics](https://tom-doerr.github.io/github_repo_stats_data/tom-doerr/zsh_codex/latest-report/report.html)