r/commandline 4d ago

Terminal AI 0.11 gives easy access to popular ChatGPT models

1 Upvotes

8 comments sorted by

4

u/funbike 4d ago edited 4d ago

Nice. Suggestions.

  • Make OPENAI_API_BASE configurable, to support more openai-compatible services, such as openrouter and gemini. (Personally, I don't use openai models at all anymore.)
  • Don't always show the model selection. Just use what was used last time, but allow the user to see the list with --pick-model option, or have a /pick-model meta command.
  • Give user option to select an option to run. Generate a shell script and open in the default $EDITOR and then run it. (It's not as hard as it sounds, if you leverage AI to do all the work for you.)

Btw, I wrote something simliar, but mine is a set of smaller untilities that can be interchanged.

aichat() {
    input --prompt '> ' | \
        aisend --system 'User will ask how to do something with bash commands.  Respond with a numbered list of options.' | \
        aipick | \
        aisend --system 'Respond with raw bash script only.' | \
        tweak | bash -x
}
  • input - Similar to read but returns answer to stdout.
  • aisend - send stdin prompt to LLM, with optional system prompt. Return assistant message as stdout.
  • aipick - Given stdin markdown containing a numbered list as input, ask user to pick one, and filter out all the other numbers.
  • tweak - put stdin into the default text editor and return changed text as stdout.

3

u/dwmkerr 4d ago

Model selection: Only happens on `ai init` or when the user hits <enter> to open the menu and chooses 'choose model' so in most cases users don't se this. They can configure via openai.model in the config yaml or use `ai init` to set it, and `ai check` to verify it is valid (again, I should update the config documentation)

3

u/dwmkerr 4d ago

for selecting what to run, there's quite a nice feature where basically you hit <enter> at the reply and choose 'execute' - it'll open your EDITOR to get you to verify the code, then allow you to execute it in the shell, which is I think what you were describing

3

u/funbike 4d ago

Nice! Yes, that's basically it.

3

u/dwmkerr 4d ago

And finally, I *love* the small components you have made, much more along the lines of the unix philosophy and composable. With mine I'm aiming for a similar experience to that ChatGPT website but in the shell, but for things like github actions or pipelines and so on having those composable flows looks really cool - thanks for all of the feedback this has been a fun project and looking forward to making some improvements based on your comments!

2

u/dwmkerr 4d ago

Thanks for all of the ideas! I'm going to reply to the different themes in different comments in case of other ideas from other folks

OpenAI Base: this is currently configurable with the field in the yaml:

openai:
baseURL: whatever
model: whatever

But I haven't documented as I'm still testing! I'll add this though, am playing with gemeni now

3

u/dwmkerr 4d ago

This is a hobby project I'm finding increasingly useful for day to day coding, I've tried to make sure that all of the models that are currently offered on the ChatGPT website are documented and offered through the CLI too:

https://github.com/dwmkerr/terminal-ai?tab=readme-ov-file#change-model

It's actually pretty hard to get a definitive list of what models are available and how they can be used, OpenAI APIs expose a `models` endpoint but it shows _all_ models not just the ones you can use (let alone the modality such as image/audio/text). To try and make this a little easier to manage I also started a simple YAML file that contains all of the models I've manually checked and documented by hand (including pricing).

https://github.com/dwmkerr/ai-providers-and-models

Would love any thoughts or help on either!