Help Setting Up An SSH Command Line Chat Interface To Google Gemini?

Not_OlesNot_Oles Hosting ProviderContent Writer

A few days ago I mentioned setting up a command line interface (CLI) to Google Geminii. What I am looking for initially is a chat interface to and from Gemini running on a Debian sid Intel i9-13900 remote server that I can access and use by ssh. Initially, I am not looking for a self-hosted Gemini web interface running on the remote server. The ssh capable interface on the remote server should send queries to Gemini and receive and print Gemini's responses.

I am looking for a chat interface, not just something for single questions. See the discussion of the difference between single queries and chat queries at

Before long I might hope for a CLI chat interface to more AIs than just Google Gemini. Ideally there might even be a fully open source interface to fully open source AI implementations.

Eventually I might even want a graphical interface. But for right now, I'm focussing on a four part process: (1) ssh from my Chromebook to command line on the remote server, (2) then from the remote server to Google Gemini, (3) response sent from Gemini back to the remote server, and finally (4) back to me via ssh -- unless I find something which provides more options while still including the ssh CLI to Gemini and back starting option.

The initial step might be to figure out what project I might try to use. Looking around, I found projects written in different languages, including Javascript, Python, and . . . Lua + Ruby and more! I've been looking at the GitHub Topics page for Google Gemini, which lists 149 repositories.

Lua + Ruby

Today I found out about Nano Bots, which the linked repository says consists of Lua 66.1% and Ruby 33.9%. Nano Bots seems to provide a command line interface for Google Gemini as well as other AIs. But, happily, the video on the Nano Bots Github page seems to show exactly what I think I might want (assuming it's a command line interface that I use via ssh and not a web interface providing a command line interface):


I haven't found a LuaJIT CLI interface to Gemini. I haven't found a LuaJIT interface to any AI.

I had no idea, when I first saw Lua a few days ago while upgrading Apache, that I was going to find out about the existence of the Luajit scripting language that is might be 285.63 times faster than Python3 in at least in one application.


@suh kindly suggested binou (also Python) but I'm unsure whether biniou provides the ssh CLI that I want. biniou's About listing describes itself as "a self-hosted webui for 30+ generative ai"


Looks like the eliben interface does more than than the reugn interface.




This rust project's About actually describes itself as "simple:" "A simple command line wrapper for Google Gemini"

Google Tutorial

I found Tutorial: Get started with the Gemini API | Google for Developers


I already have a Gemini API key, so that part is taken care of.


Does anybody know of or use additional projects which provide an ssh CLI interface to Google Gemini?

Am I misunderstanding that the Nano Bots interface is ssh? Is it really a web interface?

Is LuaJIT, without more, incapable of interfacing with Gemini?

I'm tempted to try one interface in Python, one in Go, one in Javascript, one in PHP or Laravel, that one in Rust, and one in Lua/LuaJIT. Might be fun, but that seems like too many. So, which one to try first?

Which would be the most beginner friendly implementation?

I hope everyone gets the servers they want!


  • Not_OlesNot_Oles Hosting ProviderContent Writer

    Just for fun, I shared the above OP with Google Gemini. Here is a link to what Gemini had to say:

    Please click the "v" Expand Text link to see the entire prompt sent to Gemini.

    I hope everyone gets the servers they want!

  • Not_OlesNot_Oles Hosting ProviderContent Writer
    edited July 8

    A kind person suggested that I try this search on DuckDuckGo:

    Although I already knew about the first two DDG results (which are listed in the OP),


    I did not know about the third and fourth results. The third result is a blog post explaining the eliben/gemini-cli project that was the first result. eliben/gemini-cli is programmed in Go. Here is a quote from the blog post that's relevant to my wish for a simple, ssh interface:

    I really enjoyed building gemini-cli; it's true to the spirit of simple, textual Unix CLIs that can be easily combined together through pipes.

    The fourth result is new to me. Its about section says, "Straightforward command line chat for the Google gemini-pro LLM including 2 templates for injecting info from wikipedia and howdoi into the prompts." It's programmed in Python.

    Thanks to the kind person who provided the above link to the DuckDuckGo search! <3

    Thanked by (1)vyas

    I hope everyone gets the servers they want!

  • vyasvyas OG
    edited July 8

    ssh access to llm via command line chat tool (without local install) = bliss

    Thanked by (1)Not_Oles

    Squats are the new Push-ups

  • Not_OlesNot_Oles Hosting ProviderContent Writer

    Installing eliben/gemini-cli

    After reading gemini-cli: Access Gemini models from the command-line on Eli Bendersky's website I decided to try Eli's eliben/gemini-cli. I cloned the sources off Github so I could take a look. Then I needed to install Go and also to perform the eliben/gemini-cli installation.

    Installing Go is a little different with Debian apt than untarring the Go files as recommended on the Go website's Download page. One difference is that Debian apt puts the Go files in /usr/lib/ whereas the Go website recommends /usr/local.

    One advantage of the Go website's untar install is that the installed version might be newer than whatever is available in a Linux distribution's repositories. However, Debian unstable/sid offers two Go packages, golang-go and golang-1.22-go. golang-go seems to be 1.22.3 and golang-1.22-go seems to be 1.22.5, which actually corresponds to the current release version offered on the Go website. Since apt's golang-1.22-go package seems to provide the same current release version as offered on the Go website, I decided to use the apt golang-1.22-go package for my install.

    root@lol ~ # apt show golang-1.22-go
    Package: golang-1.22-go
    Version: 1.22.5-1
    Priority: optional
    Section: golang
    Source: golang-1.22
    Maintainer: Debian Go Compiler Team <[email protected]>
    Installed-Size: 103 MB
    Depends: golang-1.22-src (>= 1.22.5-1)
    Recommends: g++, gcc, libc6-dev, pkg-config
    Suggests: bzr | brz, ca-certificates, git, mercurial, subversion
    Breaks: dh-golang (<< 1.43~)
    Download-Size: 24.7 MB
    APT-Sources: unstable/main amd64 Packages
    Description: Go programming language compiler, linker, compiled stdlib
     The Go programming language is an open source project to make programmers more
     productive. Go is expressive, concise, clean, and efficient. Its concurrency
     mechanisms make it easy to write programs that get the most out of multicore
     and networked machines, while its novel type system enables flexible and
     modular program construction. Go compiles quickly to machine code yet has the
     convenience of garbage collection and the power of run-time reflection. It's a
     fast, statically typed, compiled language that feels like a dynamically typed,
     interpreted language.
     This package provides an assembler, compiler, linker, and compiled libraries
     for the Go programming language.
     To use this version, instead of the default one provided by golang-go package,
     add /usr/lib/go-1.22/bin/ to PATH, or invoke /usr/lib/go-1.22/bin/go directly.
    root@lol ~ # date; apt-get update && apt-get install golang-1.22-go
    Wed Jul 10 01:30:37 AM UTC 2024
    Hit:1 unstable InRelease
    Reading package lists... Done
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    The following additional packages will be installed:
    Suggested packages:
      bzr | brz mercurial subversion
    The following NEW packages will be installed:
      golang-1.22-go golang-1.22-src
    0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
    Need to get 43.6 MB of archives.
    After this operation, 228 MB of additional disk space will be used.
    Do you want to continue? [Y/n] 
    Get:1 unstable/main amd64 golang-1.22-src all 1.22.5-1 [18.8
    Get:2 unstable/main amd64 golang-1.22-go amd64 1.22.5-1 [24.
    7 MB]
    Fetched 43.6 MB in 0s (107 MB/s) 
    Selecting previously unselected package golang-1.22-src.
    (Reading database ... 98732 files and directories currently installed.)
    Preparing to unpack .../golang-1.22-src_1.22.5-1_all.deb ...
    Unpacking golang-1.22-src (1.22.5-1) ...
    Selecting previously unselected package golang-1.22-go.
    Preparing to unpack .../golang-1.22-go_1.22.5-1_amd64.deb ...
    Unpacking golang-1.22-go (1.22.5-1) ...
    Setting up golang-1.22-src (1.22.5-1) ...
    Setting up golang-1.22-go (1.22.5-1) ...
    root@lol ~ # go version
    -bash: go: command not found
    root@lol ~ # /usr/lib/go-1.22/bin/go version
    go version go1.22.5 linux/amd64
    root@lol ~ # echo 'PATH=$PATH:/usr/lib/go-1.22/bin export PATH' >> /root/.bashrc
      [ log out and log in again ]
    root@lol ~ # go version
    go version go1.22.5 linux/amd64
    root@lol ~ # 

    The next step is to install eliben/gemini-cli following the one line install instruction which appears both in the blog post and in the Github repository's

    tom@lol:~$ which go
    tom@lol:~$ go install
    go: downloading v0.5.0
    go: downloading v1.14.22
    go: downloading v1.10.1
    go: downloading v1.8.0
    go: downloading v0.176.1
    go: downloading v0.11.2
    go: downloading v1.0.5
    go: downloading v0.4.0
    go: downloading v2.12.4
    go: downloading v1.6.0
    go: downloading v1.33.0
    go: downloading v1.63.2
    go: downloading v0.0.0-20240415180920-8c6c420018be
    go: downloading v0.112.2
    go: downloading v0.24.0
    go: downloading v0.19.0
    go: downloading v0.5.6
    go: downloading v0.0.0-20240415180920-8c6c420018be
    go: downloading v0.14.0
    go: downloading v1.5.4
    go: downloading v0.19.0
    go: downloading v0.3.0
    go: downloading v0.1.7
    go: downloading v0.49.0
    go: downloading v0.2.2
    go: downloading v0.3.0
    go: downloading v0.49.0
    go: downloading v0.24.0
    go: downloading v0.5.0
    go: downloading v0.3.2
    go: downloading v0.7.0
    go: downloading v0.22.0
    go: downloading v1.24.0
    go: downloading v1.24.0
    go: downloading v1.24.0
    go: downloading v1.0.4
    go: downloading v1.4.1
    go: downloading v1.2.2
    go: downloading v0.0.0-20210331224755-41bb18bfe9da

    Set the $PATH environment variable, and log out.

    tom@lol:~$ echo 'PATH=$PATH:/home/tom/go/bin export PATH' >> /home/tom/.bashrc
    tom@lol:~$ logout

    Log in again to check that the new PATH and gemini-cli are working.

    tom@lol:~$ gemini-cli help
    This tool lets you interact with Google's Gemini LLMs from the
      gemini-cli <command> [flags]
      gemini-cli [command]
    Available Commands:
      chat        Interactive chat with a model
      counttok    Count tokens in content
      embed       Access Gemini embedding models
      help        Help about any command
      models      List supported Gemini models
      prompt      Send a prompt to a Gemini model
      -h, --help           help for gemini-cli
          --key string     API key for Google AI
          --model string   Name of model to use; see (default "gemini-1.0-pro")
          --proxy string   URL of proxy server to use for the connection
      -v, --version        print version info and exit
    Use "gemini-cli [command] --help" for more information about a command.

    Next is to add the API key according to the following instructions quoted from the eliben/gemini-cli Github

    "All gemini-cli invocations require an API key for to be provided, either via the --key flag or an environment variable called GEMINI_API_KEY. You can visit that page to obtain a key - there's a generous free tier!"

    I tried accessing Gemini to get a list of available models. Here's what I saw.

    tom@lol:~$ export GEMINI_API_KEY=<KEY>
    tom@lol:~$ gemini-cli models
    Name                                    Version Max In  Max Out Description
    models/chat-bison-001                   001     4096    1024    A legacy text-only model optimized for chat conversations
    models/text-bison-001                   001     8196    1024    A legacy model that understands text and generates text as an output
    models/embedding-gecko-001              001     1024    1       Obtain a distributed representation of a text.
    models/gemini-1.0-pro                   001     30720   2048    The best model for scaling across a wide range of tasks
    models/gemini-1.0-pro-001               001     30720   2048    The best model for scaling across a wide range of tasks. This is a stable model that supports tuning.
    models/gemini-1.0-pro-latest            001     30720   2048    The best model for scaling across a wide range of tasks. This is the latest model.
    models/gemini-1.0-pro-vision-latest     001     12288   4096    The best image understanding model to handle a broad range of applications
    models/gemini-1.5-flash                 001     1048576 8192    Fast and versatile multimodal model for scaling across diverse tasks
    models/gemini-1.5-flash-001             001     1048576 8192    Fast and versatile multimodal model for scaling across diverse tasks
    models/gemini-1.5-flash-latest          001     1048576 8192    Fast and versatile multimodal model for scaling across diverse tasks
    models/gemini-1.5-pro                   001     2097152 8192    Mid-size multimodal model that supports up to 2 million tokens
    models/gemini-1.5-pro-001               001     2097152 8192    Mid-size multimodal model that supports up to 2 million tokens
    models/gemini-1.5-pro-latest            001     2097152 8192    Mid-size multimodal model that supports up to 2 million tokens
    models/gemini-pro                       001     30720   2048    The best model for scaling across a wide range of tasks
    models/gemini-pro-vision                001     12288   4096    The best image understanding model to handle a broad range of applications
    models/embedding-001                    001     2048    1       Obtain a distributed representation of a text.
    models/text-embedding-004               004     2048    1       Obtain a distributed representation of a text.
    models/aqa                              001     7168    1024    Model trained to return answers to questions that are grounded in provided sources, along with estimating answerable probability.

    eliben/gemini-cli looks like it might work for me! It's getting late here, so more soon! This was fun!

    If anyone catches a mistake that I made here or has additional suggestions or comments, I'd be grateful! <3

    I hope everyone gets the servers they want!

Sign In or Register to comment.