8 ms·
Show HN: Chatblade – A CLI Swiss Army Knife for ChatGPT
integrate chatGPT into your scripts or terminal work. Supports piping text, saving prompts, estimating costs, and some basic json/yaml extraction.
I've added some elaborate examples on the readme of how to use it with pictures, that may provide a better overview.
- totetsu 4y agoIf I used this in interactive mode, and generate a code snippet, then try to copy it, it will have | the bounding box and the beginning and end of lines |
- kinfolk0117 4y agoNice!, piping from and to chatgpt is really powerful. If you use tmux, you can pipe in `tmux capture-pane -p -S -` to ask questions about commands and outputs you have just run in your shell. I use a small script that does that, but will probably replace it with chatblade script: https://gist.github.com/kinfolk0117/7177964818f46407d4c457923650c212 https://gist.github.com/kinfolk0117/7177964818f46407d4c45792...
- noonething 4y agoBest cli gpt tool, I've seen, so far. Thank you very much for this.
- LeoPanthera 4y agoHa, I was about to release something similar to this as my first ever open-source project. Beaten by a day. And, frankly, this is better than mine. Congrats to npiv.
- quickthrower2 4y agoAnd 1k github stars. Is the creator famous?
- a_t48 4y agoRelease it anyhow!
- bckr 4y agoYup, release it anyhow. There’s plenty of storage space on the internet.
- thejosh 4y agoMultiple implementations are always appreciated, different languages etc. :)
- olalonde 4y agoSame thing happened to me two weeks ago... Released clevercli[0] only to find out aichat[1] had more features and written in Rust. [0] https://github.com/clevercli/clevercli https://github.com/clevercli/clevercli [1] https://github.com/sigoden/aichat/ https://github.com/sigoden/aichat/
- nico 4y agoAmazing! Thank you. The AI Chat is super interesting. Having that on even just a super old computer would be revolutionary for the old computer. Completely new life. Something old that was obsolete, if it can have a terminal connected to an LLM, and hopefully internet access too, then it becomes a super powerful interface that doesn’t even require images.
- jonchurch_ 4y agoIf I was going to have a pet AI who’s brain was largely in the cloud, Id put the ghost in an old machine =]
- _nalply 4y agoDoes aichat also connect to GPT-4?
- rfoo 4y ago> written in Rust Thank you, I'm glad to have a more casually hackable implementation in TypeScript. It definitely helps that you project is not written in Rust!
- j45 4y agoIt’s not always about being the first, but being the best and having enough steam to stick around. Lots of abandonware too. Launch your take anyways
- ramraj07 4y agoAt this point a good fraction of every half decent engineer is trying to do something around LLMs. Not sure if that’s the best use of the effort when the entire field is in a state of such unstable equilibrium.
- ben_w 4y agoLearning by doing is second only to learning by teaching, so my best guess is that it's probably extremely valuable.
- actually_a_dog 4y agoDo it anyway.
- RileyJames 4y agoWhere’s the harm in releasing it anyway? You’ve done the work, put it out there!
- alerter 4y agoHaha yeah, I made something similar for my own use. I bet thousands of people saw the ChatGPT interface and instinctively wanted to pipe stuff / save it easily without fussing with manual copy and paste. It's still a fun project and quite rewarding to see the text stream appear in real time in your shell.
- corobo 4y agoEven if your tool is just written in a different language you'll probably have an audience. Some people will want to hack on your code, maybe they don't know python. Maybe they just don't like python for whatever reason. Get it shipped lol. Highest rated comment and you're practically the only person not linking your own!
- jjallen 4y agoYeah still release it for sure. I don’t line python and that’s enough for me to check out a different language.
- eshack94 4y agoI think it's still worth releasing even if it's not as good as someone else's. Worst-case scenario, you're growing and learning and putting something out there that demonstrates you're developing interesting software. And who knows, maybe you'll find some other contributors, or maybe this will spark some novel ideas in someone else. You never know the power of your contributions. Don't gatekeep yourself!
- deleted 4y ago[deleted]
- 1xdevloper 4y agoI'm building something similar[1] but for the web. Imagine creating your own command palette/context menu for any web page. ChatGPT really opened up a lot of mind blowing possibilities and the speed of innovation in this space makes me both excited and anxious. Now if the Chrome store stops taking 3-4 days to approve an update, that'd be great! [1] https://sublimegpt.com https://sublimegpt.com
- zzzzzzzza 4y agohttps://github.com/Nemoden/gogpt https://github.com/Nemoden/gogpt https://github.com/NotBrianZach/bza https://github.com/NotBrianZach/bza (my concept, wip, read along repl as opposed to io focused cli tool)
- nico 4y agoFascinating stuff, thank you for sharing. You could create a graph of the intersections/references of meaning across different books. Those could represent an external memory for the agent/LLM, that it can retrieve/navigate via prompts.
- zzzzzzzza 4y agomy brother thought something like that might be useful for playing dnd with it. he says it tends to lose character cohesion as conversation goes on and of course obviously could be useful if a character shows up in a scene it just looks up their wiki entry essentially sounds complicated lol i just wanna read math book with it i could imagine it would be fun to create a wiki with friends and then like randomly roll characters into your session from your shared universe or something a lot of possibilities
- nico 4y agoHow about the inverse? Having ChatGPT be able to open a browser and perform actions (like visit a website, summarizing it, giving you the best answer, triggering actions, setting up an ads campaign, replying to comments on a social media platform, etc). Then you don’t even need to open a browser window, the agent can do it for you headless. You only need to tell it to do it via chat. Kind of like on-demand, chat-triggered selenium tests.
- icholy 4y agoHacking on something similar, but specifically for operating on source files https://github.com/icholy/codegpt https://github.com/icholy/codegpt (it's in a very rough state)
- deleted 4y ago[deleted]
- behnamoh 4y agoShell Genie is my favorite. It actually runs the commands if you want. https://github.com/dylanjcastillo/shell-genie https://github.com/dylanjcastillo/shell-genie
- nico 4y agoHas anyone created a REPL style command line interface for ChatGPT? So that it runs in the terminal instead of the browser? Edit: just saw on another post aichat - https://github.com/sigoden/aichat/ https://github.com/sigoden/aichat/
- joshka 4y agoDoing so yourself isn't too difficult... https://langchain.readthedocs.io/en/latest/modules/memory/examples/chatgpt_clone.html https://langchain.readthedocs.io/en/latest/modules/memory/ex...
- wanderingmind 4y agoIs there a similar tool that works for a chatgpt plus account?
- humanistbot 4y agoThe $20/mo plus only gets you features that you can access in the web interface. It is independent from the API usage that bills by the query. Anything you can get from the API, you can get without paying for plus.
- wanderingmind 4y agoThere have been addons that were able to use the web interface to get authorization (ex: ChatGPT4Google). I was hoping some similar session authentication and cache and make them available in terminal
- throwaway4aday 4y agoCan't access the GPT-4 model through the API yet
- greyman 4y agoMaybe you already did that, just reminder for those who don't know - you need to apply for API access for gpt-4. I did that and was granted it after about 2 days.
- karmasimida 4y agoPiping prompt is an great use case, that makes a lot of sense actually. Love it.
- simon_rider 4y agoNice, will try this out. The ascii formatting looks good on this one I made something quite similar, this can also run commands and has syntax highlighting https://github.com/lennardv2/hey-chatgpt-cli https://github.com/lennardv2/hey-chatgpt-cli
- lynx23 4y agoThis looks great. However, after generting an API key and providing it to chatblade, I get the following error: openai.error.AuthenticationError: Incorrect API key provided: user@dom***.tld. You can find your API key at https://platform.openai.com/account/api-keys https://platform.openai.com/account/api-keys. That is kind of weird, because the email given in that message looks valid, but does not match my OpenAI account name. Is that email encoded in the key? If so, apparently decoding worked, so why should the key be invalid? Am I doing something wrong here, or is something round the API key stuff broken right now?
- ramblerman 4y agoIt looks like user@dom**.tld is actually what you set as your key. I can generate the same error by setting OPENAI_API_KEY="this is wrong"; chatblade test openai.error.AuthenticationError: Incorrect API key provided: this is *rong. You can find your API key at https://platform.openai.com/account/api-keys https://platform.openai.com/account/api-keys. if you run echo $OPENAI_API_KEY you should see your key which starts with sk-......... If not thats where your issue is
- lynx23 4y agoThat is what is strange about it, OPENAI_API_KEY is set correctly, and start with sk- So I wonder where it is getting this email from.
- ramblerman 4y agocan you try: curl https://api.openai.com/v1/completions https://api.openai.com/v1/completions -H "Content-Type: application/json" -H "Authorization: Bearer $OPENAI_API_KEY" -d '{ "model": "text-davinci-003", "prompt": "Say this is a test", "max_tokens": 7, "temperature": 0 }'
- lynx23 4y agoYes, this works. So my api key is valid. But something in chatblade or the python packages it depends on trashes the input I provide, and replaces it with an email address of mine. Sounds weird, but is apparently true.
- Liutprand 4y agoI'm also developing something similar, but with a REPL style approach: https://github.com/marcolardera/chatgpt-cli https://github.com/marcolardera/chatgpt-cli
- lynx23 4y ago$ cat ~/.config/openai/completions.json ~/.local/bin/completions { "model": "text-davinci-003", "max_tokens": 1024 } #!/bin/sh jq --rawfile prompt /dev/stdin '.prompt = $prompt' \ ${XDG_CONFIG_HOME:-$HOME/.config}/openai/completions.json | curl --silent https://api.openai.com/v1/completions https://api.openai.com/v1/completions \ --header "Authorization: Bearer $OPENAI_API_KEY" \ --header "Content-Type: application/json" --data-binary @- | jq -r '.choices[].text'
- lynx23 4y agoIn Emacs: C-u M-| completions RET
- ramblerman 4y agoWell why use jq? you could decompose that into standard unix commands as well :) The main itch I wanted to scratch for my own exploration with chatgpt was that I found myself doing a lot of curl requests, and then after a few iterations I would come up with one that worked well. The next step was to reproduce that last result (without ideally hitting the openai servers again) and I wanted to pipe it to the next part of my chain. This project kind of grew out of that. Every time I had more than 2 pipes I created a new "ease of life" parameter. Although it is possible (and likely) that your working memory is far greater than mine to come up with a command like that.
- lynx23 4y agoSorry, I was not trying to belittle your effort, not at all. In fact, its sort of the other way around. You inspired me enough today (basically because I had to deep-dive and try to debug a problem which turned out to be an openai python bug) to realize how simple it actually is to use the completions API. Also, recently upgraded to Debian Bookworm, I was greeted by the new future that pip install refuses to do what it used to do, forcing you to create a venv. So I learnt about pipx, and realized this is getting a bit out of hand, esp. because the bug I was tracing ended up being somewhere deep in the dependencies of the tool you wrote. Remembering KISS, I went back to shell. I am sure I could encode stuff with plain other tools as well, but jq is actually handy for escaping json strings. And since it can read variable content from stdin, I was a happy man. Even with decently working emacs integration now. But again, thanks for writing this. I have both now, and will happily steal ideas from chatblade!